File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt abt Serialization 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 "Doubt abt Serialization" Watch "Doubt abt Serialization" New topic

Doubt abt Serialization

Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643

Above code doesnot throw Exception at run time.
it serialize string array(obs)without implementing Serializable interface.
According to me it should throw runtime Exception(NotSerializableException).

Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
You are serializing a String array. It is the String array that has to be Serializable not class FileTest. If you print obs instanceof Serializable you will see that it returns true.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
ok it means that String implements Serializable interface so TestFile
donot required to implement Serializable.

If TestFile class would be Serializing its data then Serializable interface would be required
is it so?
Naseem Khan
Ranch Hand

Joined: Apr 25, 2005
Posts: 809
10.7 Array Members


Asking Smart Questions FAQ - How To Put Your Code In Code Tags
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
i got it.
Thanks Everyone.
I agree. Here's the link:
subject: Doubt abt Serialization
It's not a secret anymore!