• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Transient Fields

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any body pls explain transient fields and serialization of objects
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Transient fields are fields that are not saved when you serialize an object. For more information about serialization, use Google to search for "java serialization tutorial". You'll find, for example, these tutorials:

Discover the secrets of the Java Serialization API
Introduction to Object Serialization
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Serialization is a mechanism built into the Java libraries that allows you to convert an object into a byte stream. You might want to do this to save an object to disk, make a copy of the object, or to transfer it over a network connection. In order to use the serialization mechanism in Java, and object must implement the Serializable interface.

You mark a field of a Serializable object as transient when you don't want that field to be a part of the serialized byte stream. You might choose to do this for several reasons. For example, the field itself might be an object that does not implement Serializable. Attempting to serialize the field would cause an exception. You might also have business reasons for making a field transient. The field could be data that you don't want to store, such as a password, or it could just be redundant data that you can recalculate once the rest of the object is deserialized.
 
Shashank Sharma
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic