I am constructing a building of 300 floors
The building's blueprint interface
Building constructed up to 200 floors - partially completed---abstract
- Partial implementation, for example, generic and HTTP servlet
Building construction completed-concrete
- Full implementation, for example, own servlet
Interface
- We don't know anything about implementation, just requirements. We can
go for an interface.
- Every method is public and abstract by default
- It is a 100% pure abstract class
- If we declare public we cannot declare private and protected
- If we declare abstract we cannot declare final, static, synchronized, strictfp and native
- Every interface has public, static and final
- Serialization and transient is not applicable, because we can't create an instance for in interface
- Non-volatile because it is final
- Every variable is static
- When we declare a variable inside an interface we need to initialize variables while declaring
- Instance and static block not allowed
Abstract
- Partial implementation
- It has an abstract method. An addition, it uses concrete
- No restriction for abstract class method modifiers
- No restriction for abstract class variable modifiers
- We cannot declare other modifiers except abstract
- No restriction to initialize variables
Taken from DurgaJobs Website