import java.io.*;

public class MyApplication {

     public static void main (String[] args) throws IOException, ClassNotFoundException {
 
         Login l1 = new Login("teacher", "class99java");
         System.out.println ("This is the object created in memory");
         l1.printout();
         ObjectOutputStream out = 
            new ObjectOutputStream (
             new FileOutputStream ("login.dat"));
         out.writeObject(l1);
         out.close();

         // We crate another login object from the stored one
         ObjectInputStream in = 
            new ObjectInputStream (
             new FileInputStream ("login.dat"));

         Login l2 = (Login)in.readObject();
         System.out.println("This is the object created from serialization");
         l2.printout();
         in.close();
     }
}
