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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "SERIALIZABLE CLASSES" Watch "SERIALIZABLE CLASSES" New topic
Author

SERIALIZABLE CLASSES

ZEESHAN AZIZ
Ranch Hand

Joined: Jan 15, 2001
Posts: 162
One very frequent question I have come across in Greens Exam is that whether class
xyz is serializable/cloneable.
I am not clear which classes are serializable, or which are cloneable. Is their any thumb
rule etc
Ricardo Polero
Ranch Hand

Joined: May 18, 2001
Posts: 128
A class is serializable (persistent in a flat file) if implement serializable or externizable interface.
Clonable is a deep/shadow copy in memory of the INSTANCE of a class (object)
I hope this light you
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Zeeshan,
Not sure there is a quick rule of thumb I took a look in the class libraries and spotted the following:
Classes implementing Serialiazable:

  • File
  • ObjectStreamClass
  • Throwable (all Errors and Exceptions inherit from Throwable so they are all serializable)
  • All the wrapper classes: Boolean, Byte, etc
  • String and StringBuffer
  • the Collection classes

  • For Cloneable, all arrays, and most, if not all the Collection classes.
    Hope that helps.
    ------------------
    Jane Griscti
    Sun Certified Programmer for the Java� 2 Platform


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SERIALIZABLE CLASSES