< Prev
Next >

Abstract Class in Java

Abstract class is a class that is declared with the abstract keyword. Unlike a simple java class, an abstract class may not only contain the regular methods but may also contain the abstract methods or a mix of regular and abstract methods.

What are abstract methods?

Abstract methods are only declared with an access modifer and a method signature(method name and parameters) and their internal logic is not provided i.e. abstract methods are not defined with a curly braces {} but they rather end with a semicolon ;

An example of an abstract method -
abstract public void add();

We have declared a method add with an abstract keyword(which makes it an abstract method). Like we made a point earlier, an abstract method ends with a semicolon ;

Some very important points about an abstract class.

interface A
void a();

abstract class B implements A

An abstract class can even implement an interface without implementing any of interface's methods.

Please share this article -

Facebook Google Pinterest Reddit Tumblr Twitter

< Prev
Next >
< Class Member Access Modifiers
Interface >
Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next
C++ and Python