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 ...

Get Java Garage now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.