0% found this document useful (0 votes)
4 views1 page

Key Points on Java Abstract Classes

The document outlines key points about abstract classes in Java, including the use of the abstract keyword, the inability to instantiate abstract classes, and the requirement for subclasses to implement abstract methods. It also discusses the relationship between abstract classes and interfaces, noting that abstract classes can provide common method implementations and can be run if they contain a main() method. Additionally, it mentions that abstract classes do not necessarily need to have abstract methods.

Uploaded by

Anima
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Key Points on Java Abstract Classes

The document outlines key points about abstract classes in Java, including the use of the abstract keyword, the inability to instantiate abstract classes, and the requirement for subclasses to implement abstract methods. It also discusses the relationship between abstract classes and interfaces, noting that abstract classes can provide common method implementations and can be run if they contain a main() method. Additionally, it mentions that abstract classes do not necessarily need to have abstract methods.

Uploaded by

Anima
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Abstract class in Java Important Points

1. abstract keyword is used to create an abstract class in java.


2. Abstract class in java can’t be instantiated.
3. We can use abstract keyword to create an abstract method, an abstract method
doesn’t have body.
4. If a class have abstract methods, then the class should also be abstract using abstract
keyword, else it will not compile.
5. It’s not necessary for an abstract class to have abstract method. We can mark a class as
abstract even if it doesn’t declare any abstract methods.
6. If abstract class doesn’t have any method implementation, its better to use interface
because java doesn’t support multiple class inheritance.
7. The subclass of abstract class in java must implement all the abstract methods unless the
subclass is also an abstract class.
8. All the methods in an interface are implicitly abstract unless the interface methods are
static or default. Static methods and default methods in interfaces are added in Java 8, for
more details read Java 8 interface changes.
9. Java Abstract class can implement interfaces without even providing the implementation
of interface methods.
10. Java Abstract class is used to provide common method implementation to all the
subclasses or to provide default implementation.
11. We can run abstract class in java like any other class if it has main() method.

That’s all for an abstract class in Java. If I missed anything important, please let us know through
comments.

You might also like