Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Interface Concept  RSS feed

 
Rajan Venkat
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me the concept of Interface , i have read about the contract concept, but i have doubt when it comes to serializable interface which doesnt have any methods to implement ,but how the JVM identifies when the class implements serializable then the instance of the class is meant for serialization. Where is the implementation of this serializable interface? How JVM recoginize it?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An introduction to interfaces can be found in the Java tutorial.

The JVM can tell which interfcaes a particular class implements from its bytecode. If you look at the bytecode specification, you'll see that there is a section in each class listing all the implemented interfaces, independently of how many methods they have. You can also use the java.lang.Class.getInterfaces method to get at this information programmatically.
 
Abdulla Mamuwala
Ranch Hand
Posts: 225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i guess the answer to your question might be
The serialization interface has no methods or fields and serves only to identify the semantics of being serializable.
, the above I found from the following URL SUN
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!