• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt:Serialization, any example?

 
mansi gupte
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2851
10
Fedora Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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.
 
mansi gupte
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@rock,

thanks for the example... at least now i can continue reading....
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic