aspose file tools*
The moose likes Java in General and the fly likes Serialization details Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serialization details" Watch "Serialization details" New topic
Author

Serialization details

Kunaal A Trehan
Ranch Hand

Joined: Feb 04, 2004
Posts: 63
Hi

Consider a case
-class B extends A

Class A implements Serializable .But class B does not
Can class B be serialized?

Consider the same case.But Class B implements Serializable.
But class A does not implement Serializable.
Can class B be serialized?

Any pointers would be helpful

Cheers
Kunal
Steve McCann
Ranch Hand

Joined: Oct 20, 2004
Posts: 81
I would say Yes in both cases:
-class B extends A
Class A implements Serializable .But class B does not

Class B therefore is serializable, as it is a subclass of A, which implements the interface.
Consider the same case.But Class B implements Serializable.

Yes, class B can be serialized, regardless of whether class A implements Serializable or not as class B implements the interface.

Steve
[ July 29, 2005: Message edited by: Steve McCann ]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10289
    
168

In both the cases, B can be Serialized


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serialization details