I have some lines of java code
class FileManager
{
File f = new File("SD.DAT");
public void wsv(ArrayList<Student> list) throws IOException
{
try
{
FileOutputStream fos = new FileOutputStream(f);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(list);
fos.close();
oos.close();
}
catch (FileNotFoundException ex)
{
Logger.getLogger(FileManager.class.getName()).log(L evel.SEVERE, null, ex);
}
}
public ArrayList<Student> rsv() throws ClassNotFoundException, IOException
{
if (!f.exists())
{
return new ArrayList<SinhVien>();
}
ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));
return (ArrayList<Student>) ois.readObject();
}
}
I want to ask: In the below code, what does:
public void wsv(ArrayList<Student> list)
public ArrayList<Student> rsv()
mean?
Why it has to return (ArrayList<Student>) ois.readObject();
I don't understand about array, so I hope you can show it to me.
Thank you so much!