why the code is un deserlaizable ! cannot read serlaizable file ! it write correctly in file but cannot read it
public ArrayList<customer> read_file(){
ArrayList <customer>file = new ArrayList<customer>();
try {
File f= new File("file.bin");
ObjectInputStream is= new ObjectInputStream (new FileInputStream("file.bin"));
int x=(int) f.length();
while(is.available()!=0){
file.add((customer)is.readObject()) ;
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException | ClassNotFoundException ex) {
Logger.getLogger(Login.class.getName()).log(Level.SEVERE, null, ex);
}
return file ;}