I need help with reading an array list from a Serialized text file, I do not believe I am having a problem with it however I cannot see if it is actually storing all of the information because I cant print it out to test it, here are the code snipets: and when I do read from the file I get the ArrayList cannot be cast to StoreAddress
FileInputStream ios = new FileInputStream("C:\\Users\\Mr Cata\\Desktop\\Testingoutput.txt");
ObjectInputStream ois = new ObjectInputStream(ios);
StoreAddress SAR = (StoreAddress)ois.readObject();
ArrayList<StoreAddress> ALStore = (ArrayList)ois.readObject();
for(int i = 0; i < ALStore.size(); i++){
String list = ALStore.get(i).toString();
}
ios.close();
next
for(int i = 0; i < ALStore.size(); i++){
ALStore.get(i);
}
...
for(int i = 0; i < ALStore.size(); i++){
if (i >= ALStore.size())
{
ALStore.add(SA);}
}
FileOutputStream fos = new FileOutputStream("C:\\Users\\Mr Cata\\Desktop\\Testingoutput.txt");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(ALStore);
fos.close();
}