Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how can we create new object using de-serlization in java ?

 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We know 4 ways to create Objects in java
using
1) New
2) clone()
3) class.forName()
4) de-serlization

My question is how we can implement so that we get new object using de-serlization.

Regards,
Prabhat
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Strictly speaking, deserialization does not create a new Object. It simply restores a previously created object from a serialized state.
This can be accomplished using an ObjectInputStream. Have a look at the API documentation, it should contain a very simple example of how to go about the deserialization process.
If you would like to know more about object serialization / deserialization, you could check out the java tutorial and this article.
 
Prabhat Ranjan
Ranch Hand
Posts: 397
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your good reply..There is some post in internet where i read it and someone expecting to know how it is working internally.


the above code is does the de-serilzation process. right ?

so in some article is was told that , please go through the below url for the same
http://www.geekinterview.com/question_details/37647
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use code tags for code, not quote tags. And while you're at it, please preserve indentation. I've modified your post so it's better readable now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic