Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args)
- {
- Avion a1 = new Avion("Boeing", "777X", "comercial" , 384);
- Avion a2 = new Avion("Boeing", "F-18", " caza polivalente" , 1);
- File file = new File("file2.dat");
- boolean append = file.exists(); // if file exists then append, otherwise create new
- try
- {
- FileOutputStream fout = new FileOutputStream(file, append);
- AppendableObjectOutputStream oout = new AppendableObjectOutputStream(fout, append);
- oout.writeObject(a1);
- oout.writeObject(a2);
- mostrarArchivo("file2.dat");
- }
- catch (EOFException e)
- {
- //es un error pero no pasa nada
- }
- catch (FileNotFoundException e)
- {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement