| Author |
Please need help in Serialization
|
gurpeet singh
Ranch Hand
Joined: Apr 04, 2012
Posts: 869
|
|
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. ???
|
OCPJP 6(100 %) OCEWCD 6(91 %)
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3795
|
|
|
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: 869
|
|
|
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: 1778
|
|
|
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.
|
 |
 |
|
|
subject: Please need help in Serialization
|
|
|