bsp; FileOutputStream os=new FileOutputStream("Test.out");
ObjectOutputStream o=new ObjectOutputStream(os);
Plant plant=new Plant("Apple");
o.writeObject(plant);
o.flush();
FileInputStream fs=new FileInputStream("Test.out");
ObjectInputStream oss=new ObjectInputStream(fs);
Plant p=(Plant)oss.readObject();
System.out.println(p.getName());
}
catch(FileNotFoundException
e){System.out.println("FileNotFoundException:"+e.getMessage());}
catch(IOException ee){System.out.println("IOException:"+ee.getMessage());}
catch(ClassNotFoundException
ee){System.out.println("IOException:"+ee.getMessage());}
class Plant implements Serializable //内部类实现Serializable接口
{
private String name;
public Plant(String pname)
&nbs