class stg{
String nom;
int age;
stg(){}
stg(String nom, int age){
this.nom=nom;
this.age=age;
}
public static void main(String []arg) throws IOException{
ObjectOutputStream obj=new ObjectOutputStream(new FileOutputStream("c:\\don.txt",true));
stg s=new stg();
s.nom="pers";
s.age=12;
obj.writeObject(s);
obj.close();
ObjectInputStream ob=new ObjectInputStream(new FileInputStream("c:\\don.txt"));
s=(stg)ob.readObject();
System.out.println(s.nom+" ; "+s.age);
}
////// tu vas executer ce programme 2 fois et dans la 2eme execution il va t'afficher que le premier enregistrement et il vas t'affiche aussi un exception (StreamCorruptedException)
et merci