Abstract Methods and Classes in Java-Key Points

  • The methods that are declared but not implemented are called abstract methods.
  • An abstract class can contain abstract methods and fully implemented methods both.
  • All of the methods in an interface  are implicitly abstract, so the abstract modifier is not used with interface methods.
  • If an abstract class contains only abstract method declarations, it should be declared as an interface instead.
  • Unlike interfaces, abstract classes can contain fields that are not static and final, and they can contain implemented methods.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s