• Post Reply Bookmark Topic Watch Topic
  • New Topic

Marker Interface  RSS feed

 
Vishwadeep Aggarwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As we know that marker interface in java has no method declaration in it.
It is just a blank interface.

Here my question is, if I have created a marker interface, then how I will tell JVM that which functionality I want to provide to the class if it has implemented my custom marker interface.

How the JVM works in the case of Marker interface??


Thanks
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't. For marker interfaces you declare (not that you should declare any these days) you need to provide the implementation somewhere in code of yours.
 
Vishwadeep Aggarwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for Serialization, is there any implementation which tells JVM that this class is eligible for serialization.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That one -being defined in the class libraries- is actually implemented by the JVM and the classes that come with it.
 
Vishwadeep Aggarwal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So when someone will ask:

can you tell me what exactly is the implementation of JVM which tells to provide the serialization functionality

what would be the answer??
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's relatively easy, because most (or maybe even all) of it is Java code - it's in the java.io.ObjectInputStream and ObjectOutputStream classes. The source code of all Java classes in the JRE comes with the JDK, so you can check it out.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!