aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Serializable... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Serializable..." Watch "Serializable..." New topic
Author

Serializable...

Priya Kannan
Ranch Hand

Joined: Jan 19, 2001
Posts: 72
Hi guys,
It's been said that the subclass of a class that implements the serializable interface will work without flashing errors only if the base class has a default constructor.(And I thought an implicit default constructor would be created if the subclass doesn't define one)
Hey, can anybody help me with this "serializable" concept.
Thanks!
Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Hi Priya,
See Sun Tech Tip: Serialization and Transient Variables.
Hope that helps.
------------------
Jane Griscti
Sun Certified Java 2 Programmer
"When ideas fail, words come in very handy" -- Goethe


Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

I'm confused; how does the text at that link explain the so-called need for an (explicit?) default contructor in the class that implements Serializable.
So far as I know, there's no such requirement.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Priya Kannan
Ranch Hand

Joined: Jan 19, 2001
Posts: 72
Thanks for the link Jane.
I really didn't expect a reply from the author of one of my favourite books!
As for the question, I'll take your word for it.Actually I came across this Qn in one of the mock exams(having trouble in finding out which!).It looked something like this,
class Base
{
int i;
}
class Derived extends Base implements java.io.Serializable
{
float f;
}
Maybe I misunderstood the context of implicit & explicit constructors,but I'm positive that it stressed the need for a constructor in the Base class if the Derived was to implement Serializable without announcing errors.So Mike,can you please help me construct the Qn. first and then provide an answer perhaps?
Thanks a ton!

Jane Griscti
Ranch Hand

Joined: Aug 30, 2000
Posts: 3141
Michael,
The link explains what serialization is; therefore, helps with the concept.
------------------
Jane Griscti
Sun Certified Java 2 Programmer
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Serializable...