• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

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

 
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
 
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
 
Sheriff
Posts: 21463
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!