posted 17 years ago
import java.io.*;
public class first{
public static void main(String\u005B\u005D args){
try{
FileOutputStream fos=new FileOutputStream("Test.txt");
ObjectOutputStream oos=new ObjectOutputStream(fos);
first p=new first();
oos.writeObject(p);
}
catch(Exception e){
e.printStackTrace();
}
}
}
Dear ranchar when i am executing the following code i am getting NotSerializable exception well i know that i have to implements Serializable in my class first but i want to know about the printStackTrace() method as when i am executing the above code i am getting exception in the following way....
1 java.io.NotSerializableException: first
2 at java.io.ObjectOutputStream.writeObject0(Unknown source)
3 at java.io.ObjectOutputStream.writeObject(Unknown source)
4 at first.main(first.java:12)
Here i would like to know that why we are getting line 2 and 3 two times
Regard
Arun