aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Please need help in Serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Please need help in Serialization" Watch "Please need help in Serialization" New topic
Author

Please need help in Serialization

gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

Please refer example on page 467 of Kathy Seirra and Bert Bates SCJP 6 Book. following is a part of the code from the example on the aforementioned page.

CODE LISTING




My question is that when we are serializing the dog object the serialization system calls the callback private writeObject method and passed it the ObjectOutputStream. but when we did os.writeInt(theCollar.getCollarSize()); how did it know which Dog's object Collar we are talking about, because we are not passing any dog reference explicitly or implicitly. ???
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4461
    
    8

That method is added to the Dog class. So there is an implicit Dog reference: this.
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
As a friendly reminder, it is good to learn more about object serialization/deserialization. But this objective has been removed from OCJP 6.0 exam.
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

thanks for the reply Helen....but the topic Serialization is given in the SCJP 6 K&B book.......Can you please give me the source of updated objectives/syllabus for OCJP 6? thanks
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
Check for SCJP 1.6 (310-065) in our SCJP-FAQ_Objectives
Helen Ma
Ranch Hand

Joined: Nov 01, 2011
Posts: 451
Even though this objective is removed from the exam, object serialization and deserialization are very useful in Java remote method invokcation (RMI).
When a client passes an object to a server over the network, the object has to be serialized. When the server receives it, it has to deserialize it.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Please need help in Serialization