| Author |
Transient Feild
|
Gaurav Pavan Kumar Jain
Ranch Hand
Joined: Mar 19, 2007
Posts: 168
|
|
Hi Friends Please make me understand what are Transeint feilds
|
 |
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
|
|
Hi Gaurav, It seems you hate book reading.
|
Thanks & Regards,<br />T.Srinivasan,<br />SCWCD 1.4(89%),SCJP 5.0(75%)<br />"That service is the noblest which is rendered for its own sake." - Mahatma Gandhi
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
A transient field is one whose state is not preserved when an object is Serialized.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Chandra Bhatt
Ranch Hand
Joined: Feb 28, 2007
Posts: 1707
|
|
Hi Gaurav, You would have to understand the Serialization to well understand the "transient". Anyway if you mark any member variable (yeah, only member variables can be marked transient) transient, while serialization takes place they are left or say are not included in instance state. Other instance variables (neither marked transient nor static) come under the state of the object and so serialized (if they are serializable). You make a member variable transient when you dont require to make that member included in the serialization process. More literally the writeObject() of the ObjectOutputStream class leaves those fields. One more scenarion may come when you are forcibly make your member varialbe transient and that is you have a reference variable of the class which is not Serializable (does not implement the Serializable interface) so to make your class Serializable you must make that reference variable which your class has "transient" so, that non serializable reference could not hindle the serialization process of your class instances.
Serialization is the process of converting instance of your class into streams of bytes and save it to the persistent storage (a file on the disk). So you can deserialize the stream back to the instance when required. "Serialization and Deserialization" are very helpful phenomenon to send the instances over the network, at the two ends the "ser and deser" process takes place.
For detailed info, refer to any book. Thanks and Regards cmbhatt
|
cmbhatt
|
 |
Gaurav Pavan Kumar Jain
Ranch Hand
Joined: Mar 19, 2007
Posts: 168
|
|
|
Thank you chandra
|
 |
 |
|
|
subject: Transient Feild
|
|
|