retriving objects from file

how can i retrive an object from a file in which i have written as object using PrintWriter i want it to be loaded into arraylist all objects of personinfo please help me out of this problem

public void saveperson()

{

try{

FileWriter fw=new FileWriter("input.txt");

PrintWriter pw=new PrintWriter(fw);

for (int i=0;i<persons.size();i++)

{

PersonInfo p=(PersonInfo) persons.get(i);

pw.println(p);

}

}catch (Exception ex)

{

System.out.println(ex);

}

}>

[553 byte] By [razaa] at [2007-10-3 2:42:56]
# 1
Objects aren't written to files with PrintWriters - they're for text only. Google for "java serialization tutorial".
CeciNEstPasUnProgrammeura at 2007-7-14 20:31:15 > top of Java-index,Java Essentials,New To Java...
# 2
I am not sure that this is what you want; but, you can serialize objects to a file and reconstruct them later using the following: http://java.sun.com/j2se/1.5.0/docs/api/java/io/ObjectOutputStream.html http://java.sun.com/j2se/1.5.0/docs/api/java/io/ObjectInputStream.html
jbisha at 2007-7-14 20:31:15 > top of Java-index,Java Essentials,New To Java...