Difference between abstract class and concrete class

1. Abstract class:class that is declared with abstract keyword is known as an abstract class. An abstract class can have abstract methods (Method without body) and concrete/non-abstract methods (Methods with the body) also. The abstract class must have at least one abstract method(Method without body). A normal class can’t have any abstract method

difference between abstract class and concrete class

2. It is declared with only an abstract keyword. You can’t declare an abstract class without a special keyword. The abstract keyword indicates the JVM to make it abstract class so that it can have an abstract method.

3. It can have abstract methods and concrete(non-abstract) methods. If we are declaring an abstract method in any class then it must be an abstract class otherwise it gives a compilation error. Because this is the general rule of the abstract class.

4. An abstract class may or may not have abstract methods.

5. An Abstract class can’t be declared as a final class because the final and abstract are opposite terms in JAVA.
Reason: An abstract class must be inherited by any derived class because a derived class is responsible to provide the implementation of abstract methods of an abstract class. But on another hand, if a class is a final class, then it can’t be extended(inherited). So both concepts are opposite to each other.

6. We can’t create an object of an abstract class. If java allows creating an object of the abstract class, then it will lead to two problems:
I). The first problem occurs because the abstract method has nobody. If someone calls the
abstract method using that object, then What would happen?
ii). Abstract classes are only like a template, to create an object of class the class should be
concrete.  because an object is concrete. An abstract class has no use without concrete class. because you can use an abstract class only when it extended by concrete class.

1. Concrete class: In Java, A simple class(Without abstract keyword) is considered a concrete class. A concrete class implements all the abstract methods of its parent abstract class. The concrete class provides the implementations of all methods of interfaces it implements.

difference between abstract class and concrete class

2. It is declared simply as Java class (Without abstract keyword). By means of the concrete class are a complete class. As you know abstract classes are incomplete classes because they have an abstract method.  But Concrete classes are considered a complete class.

 3. It can’t have any abstract methods. Concrete classes can’t contain any abstract method if we are declaring an abstract method in any class then it must be an abstract class otherwise it gives a compilation error. Because this is the general rule of the abstract class.

4. It can’t contain any abstract methods.

5. A concrete class can be declared as a final class. We can make any concrete class as final according to use. A final class can’t be extended by any class.

6. We can create an object of the concrete class. The concrete class can work without abstract class. Because they are the complete classes and independent.

Leave a Comment