When I write more than one object I get this IO error "invalid type code: AC" why?
<p>This is my file handling class....i dont have any errors in any other classes ...the program is also overwring the data in the file..it is not appending   </p>

<pre><code>import java.io.FileOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.ObjectInputStream;
import java.io.EOFException;
import java.lang.ClassNotFoundException;
import java.util.NoSuchElementException;

public class FileHandling {

    FileHandling() {
    }

    public void addCustomer(Customer customerObject, String filePath) {

        ObjectOutputStream output;

        try {
            FileOutputStream fileOut = new FileOutputStream(filePath, true);
            output = new ObjectOutputStream(fileOut);
            output.writeObject(customerObject);
            output.close();
        }

        catch (IOException ioexception) {
            System.err.println("Error with file");
        }
    // end addCustomer function
    }

    public void retrieveCustomerData(String filePath) {

        Customer record = new Customer();

        ObjectInputStream input;

        try {
            FileInputStream fileOut = new FileInputStream(filePath);
            input = new ObjectInputStream(fileOut);

        }

        catch (IOException ioexception) {
            System.err.println("Error with file1");
            return;
        }

        try {
            while (true &amp;&amp; input != null) {

                record = (Customer) input.readObject();

                System.out.println(record.getFirstName());
                System.out.println(record.getLastName());
                System.out.println(record.getEmailAddress());

            // end while loop   
            }

        // end try block    
        } catch (EOFException endOfFileException) {

        }

        catch (ClassNotFoundException ioexception) {
            System.err.println("Class not Found");
        }

        catch (IOException ioexception) {
            System.err.println("Error with file2");
            System.err.println(ioexception.getMessage());
        }

        try {
            if (input != null)
                input.close();
        }

        catch (IOException ioException) {
            System.err.println("Error closing file");
        }
    // end retrieveCustomerData function
    }

// end class fileHandling
}
</code></pre>
