Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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.
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic