Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Doubt:Serialization, any example? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Doubt:Serialization, any example?" Watch "Doubt:Serialization, any example?" New topic
Author

Doubt:Serialization, any example?

mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72

Hi all,

I currently reading stuff on the topic serialization, but cannot correlate it to a real life example somehow.I serached the forum and got some topic of the serialization..but it does not satisfy my set of questions which are as folows:

1]Any simple day to day life example that can explain serialization?
2] as explained in the below link, i interpreted that serialization can be used for making sure the data transferred is in one single format(does this make sense?)....

people, please reply to my doubts, as serialization to me , presently is not making any sense??



http://www.coderanch.com/t/411800/Java-General-beginner/java/Serialization-Unleashed



meehul Chopra
Greenhorn

Joined: Feb 23, 2009
Posts: 10
piya rai wrote:
Hi all,

I currently reading stuff on the topic serialization, but cannot correlate it to a real life example somehow.I serached the forum and got some topic of the serialization..but it does not satisfy my set of questions which are as folows:

1]Any simple day to day life example that can explain serialization?
2] as explained in the below link, i interpreted that serialization can be used for making sure the data transferred is in one single format(does this make sense?)....

people, please reply to my doubts, as serialization to me , presently is not making any sense??



http://www.coderanch.com/t/411800/Java-General-beginner/java/Serialization-Unleashed




Hi Piya,
Take the example of your cell phone games.There is always an option of "continue" in games.
class Game
{
String name;
int level;
int score;
}
Now suppose you play the above game.
Currently->
name="piya"
level=2
score=2000

Then suddenly you have some urgent work.You close the game.
But internally the "Object" of the above Game class gets stored somewhere in the memory,that is the above instance variables
get stored in a file (serialization).
Now next time when you select "continue" it retrieves the appropriate object from the file (deserialization) ,that is restores the values
of the instance variables and continues your game with the previous values..

Objects also need to be serialized whenever they need to be transported over a network.

Hope this will solve your doubt
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2712
    
    5

"rock Chopra " welcome to Javaranch
please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
mansi gupte
Ranch Hand

Joined: Dec 30, 2008
Posts: 72
@rock,

thanks for the example... at least now i can continue reading....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt:Serialization, any example?
 
Similar Threads
Is your life affected by Astronomical discoveries?
serialization
Casting question
Threads and Sockets
Serialization in java