I have a folder called "Saves" in the same directory as the program that I want to put save files, but I only know how to make a save file in the same directory as the program. How could I modify this code such that the saves are created in "Saves"? Researching this wasn't yielding a straight answer so I came here.
public void save(Serializable data, String fileName)
{
try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(fileName)))
{
oos.writeObject(data);
}
catch (IOException ex)
{
System.out.println("Error occured while saving:");
System.out.println(ex.getMessage());
}
}