O'Reilly logo

Java Garage by Eben Hewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Dude, Where's My Implementation?

An abstract class is a class whose declaration includes the keyword abstract. Based on that definition, you should be able to write the simplest possible abstract class. Okay…geez…I'll do it. How about this:

public abstract class SimplestAbstractClass { }

That meets the definition, and so it compiles.

You might never write an empty class such as this. But there are occasions when you will come across such empty classes; such usage aims to provide a formal organization to an application for later possibilities for extensibility.

The following is also an abstract class:

public abstract SecondAbstractClass {
   public abstract void someMethod();
}

The preceding code declares an abstract class that includes an abstract ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required