It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt abt Serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Doubt abt Serialization
 
Similar Threads
Serializable question in mock exam
FileOutputStream
serialization for class Object references
Serialization Question
Getting an exception(Serialization)