Whenever I load the object there are these random symbols around the data.
public void Save()
{
try
{
System.out.println("Where would you like to Save?");
File thefile = new File(Input.next());
FileOutputStream fout = new FileOutputStream(thefile);
ObjectOutputStream oos = new ObjectOutputStream(fout);
oos.writeObject(list.getRoot());
oos.flush();
oos.close();
fout.flush();
fout.close();
}
catch (Exception e1)
{
e1.printStackTrace();
}
}
public void Load()
{
try
{
System.out.println("Where would you like to Load from?");
BufferedReader reader = new BufferedReader(new FileReader(Input.next()));
String line;
int count = 0;
list = new tree();
while ((line = reader.readLine()) != null)
{
System.out.println(line + "\n");
list.Add(line);
count++;
}
reader.close();
} catch (FileNotFoundException e1)
{
e1.printStackTrace();
} catch (IOException x)
{
x.printStackTrace();
}
}
}
The object is a binary tree.