• 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

SERIALIZABLE CLASSES

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic