Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why serialize needs the .class file?  RSS feed

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Bruce Eckel said in "Thinking in Java", When we deserialize an object(like "Aobj") from a file we still need the class file("Aobj.class") in the classpath.

why?

Is it the same in Java RMI when we transmit the object between the RMI server and clients?
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Serialization only stores the state of the object. A new object is built from the .class file and the saved state is applied to it.
 
Jimmy Chen
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!