I mean, i know its just a hint to the JVM that "ok buddy- its your responsiblity to take care of this special behavior of the object" , but how does it really work?
Is there any call-back mecanism in place , now u might think that marker interfaces dont have any methods so which call back methods! But my marker interface can be extended by another interface X.Now that X implementation is the JVM implementation class or some native implementation or JNI( for serializable)?
small class-dia just to depict what i mean by my question. extends X----------->serializable A | implements | | someclass
You can recognize an object that implements an interface by using "instanceof". If you look at the source of java.io.ObjectOutputStream, you can see lines like "if (obj instanceof Serializable)" that do certain things fro serializable objects, and different things for other objects.
Siddharth bal sharma
Joined: Apr 27, 2006
i asked abt how the marker interfaces are implemented i.e. they act as marker for JVM, but how does JVM tales care of it?
Same way as any other interface a class implements, it lists the class as implementing that interface. How another class would use a class implementing your marker interface depends entirely on the programmer of that class.