| Author |
regarding serializatiotion
|
Saral Saxena
Ranch Hand
Joined: Apr 22, 2011
Posts: 202
|
|
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
Bartender
Joined: Sep 08, 2007
Posts: 2925
|
|
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.
|
Mohamed Sanaulla | My Blog
|
 |
Saral Saxena
Ranch Hand
Joined: Apr 22, 2011
Posts: 202
|
|
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
Joined: Sep 08, 2007
Posts: 2925
|
|
|
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
Joined: Jan 03, 2004
Posts: 5807
|
|
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
Bartender
Joined: Aug 22, 2010
Posts: 2319
|
|
|
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
Joined: Sep 08, 2007
Posts: 2925
|
|
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.
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: regarding serializatiotion
|
|
|