What is class ?
class is blueprint from which we create object.
we declare class with the help of
classkeyword.Inside the class, we can directly write fields (non-static / static), blocks (non-static / static), constructors, concrete methods (non-static / static), inner classes, interfaces, and so on.
Generally, we can create object of class with the help of new keyword.
class is also a user-defined data type.
we cannot write abstract method inside the normal class.
Abstract Class :
- Abstract class is declare with the abstract keyword .
- We can not create object of the abstract class .
- Abstract class may contain non - abstract method ( concrete methods ) , may contain abstract method , may contain non - static field . may contain static field .
- Abstract class can not be final .
- for declare abstract class , we use
abstractkeyword.
Note :
- Abstract method is type of method having no body . We have to provide body of abstract method in their child class .
interface :
- Interface is a blueprint that contains abstract methods and constant (public static final) variables.
- for declare interface , we use
interfacekeyword . - with the help of interface , we achieve multiple inheritance .



Top comments (0)