public void saveData()
{
File file;
ObjectOutputStream oos;
FileOutputStream fos;
boolean b;
file = new File("info.dat");
if(file.exists())
b = file.delete();
file = new File("info.dat");
try
{
fos = new FileOutputStream(file);
oos = new ObjectOutputStream(fos);
if(fos != null && oos != null && unit!= null && arr.length != 0)
{
for(int i = 0; i < arr.length; i++)
{
oos.writeObject(arr);
}
oos.flush();
fos.close();
oos.close();
}
}
catch(IOException e)
{
System.out.println(e.getMessage()+ "!!!");
}
}
i have an array of type Unit, which is arr. i want to write the
contents of this array into the binary file info.dat. is this ok?
because when i run the program, it doesn't write it, it goes to the
catch. anyone?