package filetest;
import java.io.*;
public class test1 implements Serializable {
int i;
transient r r1 = new r();
public static void main(String[] args) {
test1 t = new test1();
t.i = 2;
try {
FileOutputStream fs = new FileOutputStream("foo1.ser");
ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(t);
os.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
import java.io.*;
public class test1 implements Serializable {
int i;
transient r r1 = new r();
public static void main(String[] args) {
test1 t = new test1();
t.i = 2;
try {
FileOutputStream fs = new FileOutputStream("foo1.ser");
ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(t);
os.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
////////////////////////////////////////////////////
package filetest;
import java.io.*;
public class test2 {
public static void main(String[] args) {
try {
FileInputStream fs = new FileInputStream("foo1.ser");
ObjectInputStream os = new ObjectInputStream(fs);
Object atest = os.readObject();
test1 a = (test1) atest;
System.out.println(a.i);
} catch (Exception ex) {
}
}
}