Inheritance in Interface

  1. interface A{
  2. void show();
  3. }
  4.  
  5. interface B extends A{
  6. void print();
  7. }
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.

About the Author

Founder of javainsimpleway.com
I love Java and open source technologies and very much passionate about software development.
I like to share my knowledge with others especially on technology 🙂
I have given all the examples as simple as possible to understand for the beginners.
All the code posted on my blog is developed,compiled and tested in my development environment.
If you find any mistakes or bugs, Please drop an email to kb.knowledge.sharing@gmail.com

Connect with me on Facebook for more updates

Share this article on