
thank you for your feedback!
Paul.
Moderators: Site Manager, fjwalraven
What if the code was changed?Which fields of the above class will be have the same values ...
Code: Select all
public class Test35 {
public static void main(String... strings) throws IOException, ClassNotFoundException {
String file = "./test.data";
/*Data d = new Data();
d.f1 = "f1";
d.f2 = 2;
d.f3 = true;
try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file))) {
out.writeObject(d);
}*/
Data d2 = null;
try (ObjectInputStream in = new ObjectInputStream(new FileInputStream(file))) {
d2 = (Data) in.readObject();
}
System.out.println(d2);
}
}
class Data implements java.io.Serializable {
public static String f1;
public static transient int f2;
public transient boolean f3;
public final static String f4 = "442";
public String f5 = "5";
}
should meant that this class remains untouched, yeah?the above class
Users browsing this forum: No registered users and 175 guests