Hi I am pretty new to java and im having a problem with my program. My problem is appending objects to a file. When my program is first opened i can save books to the file and display them. However, when i exit and reopen the project i can only display objects previously added even after i save new objects to the file. i think the problem is that the ObjectoutputStream is writing a new header to the file each time it is opened. Is there any way to get past this?
objOutputBook = new FileOutputStream("Book.txt",true);
objSaveBook = new ObjectOutputStream(objOutputBook);
Book bookCurrent = new Book(txtId.getText(), txtTitle.getText(),txtAuthor.getText(),
txtPublisher.getText(),txtGenre.getText(), Float.parseFloat(txtPrice.getText()), Integer.parseInt(txtQty.getText()));
objSaveBook.writeObject(bookCurrent);
}