• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

regarding serializatiotion

 
Ranch Hand
Posts: 203
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..!
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic