14 Mart 2010, 20:06
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| import java.io.*;
public class UnserializeBoolean {
public UnserializeBoolean () {
Boolean booleanData = null;
try {
FileInputStream fis = new FileInputStream("boolean.ser");
ObjectInputStream ois = new ObjectInputStream(fis );
booleanData = (Boolean) ois. readObject();
ois. close();
} catch (Exception e ) {
e. printStackTrace();
}
System. out. println("Unserialized boolen from " + "boolean.ser");
System. out. println("Boolean data: " + booleanData );
System. out. println("Compare data with true: " + booleanData. equals(new Boolean("true")));
}
public static void main (String [] args ) {
UnserializeBoolean uab = new UnserializeBoolean ();
}
} |