jQuery in Action, 2nd edition*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt abt Serialization" Watch "Doubt abt Serialization" New topic
Author

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).

Thanks.
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


Naseem


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.
 
Consider Paul's rocket mass heater.
 
subject: Doubt abt Serialization
 
Similar Threads
Serialization Question
serialization for class Object references
Getting an exception(Serialization)
Serializable question in mock exam
FileOutputStream