Generally, they are used to give additional information about the behaviour of a class.It is just used to "mark" Java classes which support a certain capability . Examples: java.util.RandomAccess
java.io.Serializable
java.rmi.Remote
java.util.EventListner
javax.servlet.SingleThreadModel
java.lang.Clonable
javax.ejb.EnterpriseBean
Marker interface is used as a tag to inform a message to the java compiler so that it can add special behaviour to the class implementing it. Java marker interface has no members in it
Lets take the java.io.Serializable marker interface. It doesnot has any members defined it it. When a java class is to be serialized, you should intimate the java compiler in some way that there is a possibility of serializing this java class. In this scenario, marker interfaces are used. The java class which may be serialized has to implement the java.io.Serializable marker interface. In such way, we are intimating the java compiler.
Naresh Tuhania From IBM
The Interface which doesn't have any declarations of methods are called the markable interface (or marker interface)They are named marker interfaces, because their only purpose is to mark special classes.Example:In the Java API there is the interface Cloneable. Since Object already has the method clone() the Cloneable Interface is empty and is only used to mark classes, which objects are allowed to clone.There are Three marker interfaces that are Serializable,Remote and Cloneable.
yes we can define a variable in an interface in java.
Runnable interface
According to a beginner's book on Java, an interface can't have constructors. Also, the interface itself can't contain the method implementation.
Java Native Interface JNI is an interface between java and applications and libraries written in other languages. As an example, JNI enables Java programs to use C libraries and also enables C programs to use Java classes.
The Interface which doesn't have any declarations of methods are called the markable interface (or marker interface)They are named marker interfaces, because their only purpose is to mark special classes.Example:In the Java API there is the interface Cloneable. Since Object already has the method clone() the Cloneable Interface is empty and is only used to mark classes, which objects are allowed to clone.There are Three marker interfaces that are Serializable,Remote and Cloneable.
yes we can define a variable in an interface in java.
NO, we cannot create a contructor for an interface in java.
interface is a list of methods which implements that interface
A tagging interface type in Java is an interface that has not defined methods such as the java.io.Serializable interface.
Runnable interface
Yes. This is a valid interface definition in Java: interface Useless {}
An interface in Java is like an abstract class, but there are no method bodies allowed in it and it has to be declared with the interface keyword. It is Java's way of getting around the Deadly Diamond of Death. Only abstract methods and constants are allowed in it.
Interface Java can be used for a variety of tasks and commands such as .swf files, Java files, running scripts, as well as website video players for websites.
Interface is collection of abstract methods which has only declaration and no implementation
maybe
According to a beginner's book on Java, an interface can't have constructors. Also, the interface itself can't contain the method implementation.