This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
Similar Threads
Inconsistent output
Time for Part 2 and 3
Question about HFEJB
test
fear psychosis