| <<< Serializable | Index | class RestorePerson >>> |
import java.util.*;
import java.io.*;
public class SavePerson {
public static void main(String args[]){
Person person = new Person( "Jack Jones" );
try {
FileOutputStream fos = new FileOutputStream( "Name.txt" );
ObjectOutputStream oos = new ObjectOutputStream( fos );
System.out.print( "Person Name Written: " );
System.out.println( person.getName() );
oos.writeObject( person );
oos.flush();
oos.close();
} catch(Exception e){
e.printStackTrace();
}
}
}
| <<< Serializable | Index | class RestorePerson >>> |