aspose file tools
The moose likes Java in General and the fly likes Question about serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Question about serialization" Watch "Question about serialization" New topic
Author

Question about serialization

Vivek S. kumar
Greenhorn

Joined: Dec 19, 2006
Posts: 25
Hello

I have class implementing Serializable

and it have a data member of type Object.

As a plain java Object is not serializable so what will happen in this case?

Only this method will not be serialized or the entire class will not be serialized?

Vik


"Make Your Own Rules and Rock The World"
Jesper de Jong
Java Cowboy
Bartender

Joined: Aug 16, 2005
Posts: 12929
    
    3

What happened when you tried it out?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Vivek S. kumar wrote:Hello

I have class implementing Serializable

and it have a data member of type Object.

As a plain java Object is not serializable so what will happen in this case?

Only this method will not be serialized or the entire class will not be serialized?

Vik


You mean to say, "Only this Object........."?

NotSerializableException will be thrown. Don't you try it?


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Abimaran Kugathasan wrote:NotSerializableException will be thrown. Don't you try it?

Well, now he doesn't have to, because you flat-out told him. In general, we like to have people try things out on their own.
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

Sorry, I think, he tried it and couldn't solve this problem... really sorry...
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Question about serialization
 
Similar Threads
Serializable
Serialization Code
How does marker interfaces work?
Can Serializable object contain non-serializable member variables that get serialized
Marker Interfaces