Oops sorry! posted my old code!
This was my new one, but yeah, I did what you suggested and it's still not printing
import java.io.*;
public class HelloWorld{
public static void main(String []args){
System.out.println("cehck");
fileTwo nfileTwo = new fileTwo("Matt", "is this working?%n");
fileTwo nfileTwoTwo = new fileTwo("Jon", "I am a lion%n");
fileTwo[] fileArray ={nfileTwo, nfileTwoTwo};
fileOne nfileOne = new fileOne();
nfileOne.save(fileArray);
fileTwo[] reloadedFiles = nfileOne.load();
for(fileTwo files:reloadedFiles){
System.out.println(files);
}
}
}
class fileOne implements Serializable{
public void save(fileTwo[] array){
try(
FileOutputStream fos = new FileOutputStream("savedFile.ser");
ObjectOutputStream oos = new ObjectOutputStream(fos);){
oos.writeObject(array);
}
catch(IOException ioe){
System.out.println("Problem saving Treets");
ioe.printStackTrace();
ioe.getMessage();
}
}
public fileTwo[] load(){
fileTwo[] fileResArray = new fileTwo[0];
fileTwo[] fileLoadArray = (fileTwo[]) fileResArray;
try(
FileInputStream fis = new FileInputStream("savedFile.ser");
ObjectInputStream ois = new ObjectInputStream(fis);){
ois.readObject();
}catch(IOException ioe){
System.out.println("Error reading file, deserialziaton problem");
ioe.printStackTrace();
}catch(ClassNotFoundException cnfe){
System.out.println("Error loading file, deserelization");
cnfe.printStackTrace();
}
return fileLoadArray;
}
}
class fileTwo implements Serializable{
String personName;
String personQuote;
fileTwo(String name, String quote){
name = personName;
personQuote = quote;
}
}