Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Question about serialization  RSS feed

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Java Cowboy
Sheriff
Posts: 16083
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it out?
 
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I think, he tried it and couldn't solve this problem... really sorry...
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!