Course Content
Java RMI
0/1
Java Inner class
0/1
Java File class
0/1
Layout Managers
0/1
Java Programming Tutorial
About Lesson

Difference Between Concrete Class, Abstract Class, Final Class, Interface

Class, interface, abstract class, final class are the important component of the Java language. Before discussing about the differences among them first lets get little intro about all these. So that we can get some idea what these terms refer to.

Concrete Class

A class that has all its methods implemented, no method is present without body is known as concrete class.

In other words, a class that contains only non-abstract method will be called concrete class.

Abstract Class

A class which is declared as abstract using abstract keyword is known as abstract class. abstract contains abstract methods and used to achieve abstraction, an important feature of OOP programming. Abstract class can not be instantiated.

Interface

Interface is a blueprint of an class and used to achieve abstraction in Java. Interface contains abstract methods and default, private methods. We can not create object of the interface. Interface can be used to implement multiple inheritance in Java.

Final class

Final class is a class, which is declared using final keyword. Final class are used to prevent inheritance, since we cannot inherit final class. We can create its object and can create static and non-static methods as well.

Here in this table we are differentiating class, abstract class, interface etc based on some properties like: access modifier, static, non-static etc.

  Concrete Class Abstract Class Final Class Interface
Constructor Yes Yes Yes No
Non-static (method) Yes Yes Yes Yes
Non-static (variable) Yes Yes Yes No
Access Modifier (by default) Default Default Default Public
Object Declaration Yes Yes Yes Yes
Instantiation Yes No Yes No
Relation Both (IS-A & HAS-A) IS-A HAS-A IS-A
Final Declarations May or May not be May or May not be May or May not be Only Final
Abstract Declarations No May or May not be No Fully Abstract
Inheritance Keyword Extends Extends No Inheritance Implements
Overloading Yes Yes Yes Yes
Overriding No No No No
Super keyword Yes Yes Yes No
This keyword Yes Yes Yes Yes
Byte Code .class .class .class .class
Anonymous Class No Yes No Yes
Keywords used for declaration No keyword Abstract keyword Final keyword Interface keyword
Inheritance Single Single No Inheritance Multiple
Static Variables Yes Yes Yes Yes

error: Content is protected !!