Inheritance in Interface
- interface A{
- void show();
- }
- interface B extends A{
- void print();
- }
interface A{ void show(); } interface B extends A{ void print(); }
Now interface ‘B’ is inheriting interface ‘A’.
Now class implementing ‘B’ should implement both show() and print() methods.
Ground rule : Class can implement more than one interfaces.
Interface can extend more than one interfaces.
Marker Interface(also called tagged interface)
An interface that has no member inside it is called Marker interface.
It means its an empty interface.
But how does an empty interface is useful ?
Yes these interfaces will provide some information to JVM so that it can perform some operations.
Example : Serializable,Remote,Cloneable.
We will see custom marker interfaces in the next post.