Interface
- interface is a blueprint of a class
- It has static constants and abstract methods only
- It is used to achieve fully abstraction and multiple inheritance in java
1. Why use it
- It is used to achieve fully abstraction
- By interface, we can support the functionality of multiple inheritance
- It can be used to achieve loose coupling
- The java compiler adds public and abstract keywords before the interface method and public, static and final keywords before data members
2. Example
3. Multiple inheritance
1) Is it possible by interface, why?
- There is no ambiguity as implementation is provided by the implementation class
4. What is marker or tagged interface?
- An interface that have no member is known as marker or tagged interface
- Serializable, Cloneable, Remote....
- They are used to provide some essential information to the JVM so that JVM may perform some useful operation
'Back-End > Java_1' 카테고리의 다른 글
[Java] Encapsulation (0) | 2016.09.12 |
---|---|
[Java] Package (0) | 2016.09.12 |
[Java] Abstract class (0) | 2016.09.12 |
[Java] Instanceof (0) | 2016.09.09 |
[Java] Static Binding and Dynamic Binding (0) | 2016.09.08 |