File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding serializatiotion

 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

Could you please advise me the technical reason that why the Object class was not made to implement the serializable interface..!
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saral Saxena wrote:Hi Folks,

Could you please advise me the technical reason that why the Object class was not made to implement the serializable interface..!

Not always do you want to serialize the object, and not all objects are going to be serialized.
 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohamed Sanaulla wrote:
Saral Saxena wrote:Hi Folks,

Could you please advise me the technical reason that why the Object class was not made to implement the serializable interface..!

Not always do you want to serialize the object, and not all objects are going to be serialized.


Hi ,

could you please come up with any technical example that will make understandings more clear..!!
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know the real technical reason, but I can think of it. I dont think its a good idea to unnecessarily extend/implement classes/interfaces (even though they might be just Marker interface). If they are not marker interfaces then you would end up polluting the class with unnecessary implementations, extensions.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saral Saxena wrote:
Mohamed Sanaulla wrote:
Saral Saxena wrote:Hi Folks,

Could you please advise me the technical reason that why the Object class was not made to implement the serializable interface..!

Not always do you want to serialize the object, and not all objects are going to be serialized.


Hi ,

could you please come up with any technical example that will make understandings more clear..!!


What's not clear? We only want some classes to be serializable, not all. If Object implements Serialzable, then everything would implement it, and we don't want that.
 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An interface cannot be "unimplemented". If the Object class implemented the Serializable interface, all Java objects would inevitably implement it as well, and subsequently there would not be any need for that interface at all. The way it is now, a class designer can choose whether his class should or should not implement that interface and can therefore decide whether the class will be serializable or not.
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saral Saxena wrote:Hi Folks,

Could you please advise me the technical reason that why the Object class was not made to implement the serializable interface..!


And if in case they did, you already know from this thread, what wrong it can do.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic