aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes About serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "About serialization" Watch "About serialization" New topic
Author

About serialization

jaman tai
Ranch Hand

Joined: Sep 26, 2005
Posts: 37
Class fields with the following modifiers will not be serialized

1. private
2. static
3. transient
4. protected

the answer is 2 and 3. i dont know why 2 is correct.
Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
i am not exact sure but it might be possible that static variables are class variables and they does not belong to any particular object, in serializatin we store the current status of the OBJECT and its related variables and as static variables are of CLASS not of OBJECT thsts why they arte not Serialized.

Hope it might help you out.

Regards

Gaurav
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Originally posted by Gaurav Chhabras:
i am not exact sure but it might be possible that static variables are class variables and they does not belong to any particular object, in serializatin we store the current status of the OBJECT and its related variables and as static variables are of CLASS not of OBJECT thsts why they arte not Serialized.


True, static varibles / methods / blocks are belongs to class and they are not belongs to objects. Hence static varible can't be serialised.


My blood is tested +ve for Java.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About serialization