CodesJava

Easy learning with example program codes

What is marker interface?


Marker/Tagging Interfaces:

An interface with no methods is known as marker or tagged interface.

Why marker interface used:  

It provides some useful information to JVM/compiler so that JVM/compiler performs some special operations on it. It is used for better readability of code.  Example: Serializable, Clonnable etc.

Syntax:

public interface Interface_Name {

}

 

Java interview questions on interface

Sign Up/ Sign In
Ask a Question


Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki