public static void readObj() throws Exception
{
ObjectInputStream ois =
new ObjectInputStream(new FileInputStream("person.object"));
Person p =null; //(Person)ois.readObject();
for (int i = 0; i < 3; i++)
{
p=(Person)ois.readObject();
System.out.println(p.getAge()+p.getName());
}
ois.close();
}