Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why serializable interface called as marker interface

 
kesava chaitanya
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

when a class implements the interface we will override those methods in the class;But in the case of serializable interface we wont implement(readObject and writeObejct) methods in the particulr class.why?
[ November 08, 2004: Message edited by: kesava chaitanya ]
 
Mike Gershman
Ranch Hand
Posts: 1272
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many serializable objects can use the default versions of readObject() and writeObject() contained in ObjectInputStream and ObjectOutputStream respectively. Only if the default versions can't handle a class does that class have to supply specialized versions of readObject() and writeObject()

Putting these methods in the Serializable interface would not allow any serializable classes to use the default methods.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!