my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Object Graphs. 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 "Object Graphs." Watch "Object Graphs." New topic
Author

Object Graphs.

Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
Hi Ranchers ,

Today , I was going through our book K & B on the page 451 i.e the code which explains Serialization Mechanism of Java. First of all , I did not understand what it explains about Object Graphs , One thing i understood that one object refers to other and that object too has an referece to other.. Correct me if i am wrong..

Also , I was not clear when is the usage of defaultReadObject and defaultWriteObject done and yes , I noticed that there was also a method called writeInt() , Similarly for every primitive do we have an read and write method? for ex : readString , writeString etc...

Only this was the topic which i found was a bit touch for me to understand in this book... :-( Please help me. Thx in Advance.

Bert , Did you forget of making me a Ranch Hand or Bartender or anything else than a greenhorn ? :-) I have tried helping many peoples at (Java Beginner section).

Thanks in Advance

Yogendra Joshi.


Meri Zindagi Hain Tab Tak.. Jab Tak Tera Sahara.... Har Taraf Tu Hi Tu Hain SAI Tera Hi Hain Nazara.....
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Yogendra Joshi:
... Bert , Did you forget of making me a Ranch Hand or Bartender or anything else than a greenhorn ? :-) I have tried helping many peoples at (Java Beginner section)...

You're just a few posts away from becomming a ranch hand. (See Saloon Titles.)


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
Hi Marc , Thx for the info.. Atleast after the 30th , I'll be called Ranch Hand.. :-) And yes the important part , did you or any of our ranchers found a solution to my actual query above ?

Waiting for a revert.

Regards ,

Yogendra Joshi.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18523
    
  40

Today , I was going through our book K & B on the page 451 i.e the code which explains Serialization Mechanism of Java. First of all , I did not understand what it explains about Object Graphs , One thing i understood that one object refers to other and that object too has an referece to other.. Correct me if i am wrong..


A "graph" is simply a data structure where each node can have any number of references to other nodes. An "object graph" just means that you have an object that can refer to any number of objects.

Now why is this important to object serialization? Unlike other data structures like a linked list or tree, there is really no guarantee of a single path from a first node, or root node. It is possible, while traversing a graph, to return to an object, that has already been traversed.

To solve this, object serialization must keep track of which objects have already been serialized. And when it encounters such an object, the serialization protocol sends some kind of mark that refers to a previously serialized object. (note: the actual reference can't be used because it may be in a different location on the other side of the serialization)

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Yogendra Joshi
Ranch Hand

Joined: Apr 04, 2006
Posts: 213
Hi Henry ,

Thanks for your reply. Now i understood that my assumption and your nice explaination both are correct.

Thanks again ,

Yogendra Joshi.
 
Consider Paul's rocket mass heater.
 
subject: Object Graphs.
 
Similar Threads
Graphs.
Java Graphs
why to create two classes?
Creating custom graphs in Java ?
How do I draw bar charts using java api