• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How can I judge if a class is serializable or not?

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question 7.
A Vector class in jdk 1.2
1.is public
2.is final
3.implements java.util.List
4.is serializable
has only One constructor

ans:1.3.4
--------------------------------------------------------------------------------
Question 8.
A String Class
1.is final
2.is public
3.is serializable
4.has a constructor which takes a StingBuffer Object as an Argument
ans:1.2.3.4.
In the jdk-doc ,it deosn't specify the feature if a class/interface is subclass of the serializable interface,such as the class String.How can I judge wheathe a class is serializable??
How can I judge if a class is serializable or not?
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, James:
A class mark itself as Serializable by either implementing Serializable or Externalizable. The former one is just a mark interface with no method defined. The latter is the sub-interface of the former one.
Hope it helps,

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
try my mock exam¹²³ at my homepage.
 
Gong James
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

As is well know that Vector is serializable ,but when i look up the jdk-doc ,I can't find the key-word such as "implements serializable "or"implements exserializable ".

Can you give me a explaination about it ,thank you very much ,I am beginner!!
 
Guoqiao Sun
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How come? JDC in my side says
public class Vector
extends AbstractList
implements List, Cloneable, Serializable.
Check it again!
Regards

------------------
Guoqiao Sun
Sun Certified Programmer for Java™ 2 Platform
try my mock exam¹²³ at my homepage.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic