class TO implements Serializable{ static TO tt= new TO(); }public class ObjectStream { public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException { ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("object.txt")); ObjectOutputStream os2 = new ObjectOutputStream(new FileOutputStream("object2.txt")); ObjectInputStream is=new ObjectInputStream(new FileInputStream("object.txt")); ObjectInputStream is2=new ObjectInputStream(new FileInputStream("object2.txt")); os.writeObject(TO.tt); os2.writeObject(TO.tt); TO bb=(TO)is.readObject(); TO cc=(TO)is2.readObject(); System.out.println(bb==cc); is.close(); os.close(); is2.close(); os2.close(); }}
static TO tt= new TO();
}public class ObjectStream {
public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException {
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("object.txt"));
ObjectOutputStream os2 = new ObjectOutputStream(new FileOutputStream("object2.txt"));
ObjectInputStream is=new ObjectInputStream(new FileInputStream("object.txt"));
ObjectInputStream is2=new ObjectInputStream(new FileInputStream("object2.txt"));
os.writeObject(TO.tt);
os2.writeObject(TO.tt);
TO bb=(TO)is.readObject();
TO cc=(TO)is2.readObject();
System.out.println(bb==cc);
is.close();
os.close();
is2.close();
os2.close(); }}