Saturday, September 21

Marker interface , Cloneable, serializable,Eventlistener,Remote,RandomAccess,EnterpriseBean

Marker interface , Cloneable, serializable,Eventlistener,Remote,RandomAccess,EnterpriseBean




Marker Interfaces are give about the implementing classes.


Interface in java defines a specific behavior while class can define both behavior and state. So Interface is pure behavior and class represent state and behavior. Interfaces are used in Java to specify the behavior of classes that implement those interfaces.. interfaces in Java that have no behavior  are known as marker interfaces. They have no method defined in them but are absolutely empty.



-->


examples of marker interfaces

Java.lang.Cloneable
If you want to added cloneable feature in a class ,that class needs to implement Cloneable interface.

java.io.Serializable Serialization is nothing but s saving the state of an object to persistent storage as byte stream. Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized.  The serialization interface has no methods or fields .

java.util.EventListener
A tagging interface that all event listener interfaces must extend.

java.rmi.Remote
The Remote interface serves to identify interfaces whose methods may be invoked from a non-local virtual machine. Any object that is a remote object  implements this interface.

Javax.servlet.SingleThreadModel
Ensures that servlets handle only one request at a time. This interface has no methods. If a servlet implements this interface, you are guaranteed that no two threads will execute concurrently in the servlet's service method.

Java.util.RandomAccess
This Marker interface used by classes implementing List interface to  support fast random access. The primary purpose of this interface is to allow generic algorithms to alter their behavior to provide good performance when applied to either random or sequential access lists.

Javax.ejb.EnterpriseBean
The EnterpriseBean interface must be implemented by every enterprise Bean class. It is a common superinterface for the SessionBean, EntityBean and MessageDrivenBean interfaces.


Reference From Sun Documentation







No comments:

Post a Comment