eng
competition

Text Practice Mode

java storage

created Apr 9th 2021, 14:50 by NguynHng26


0


Rating

51 words
5 completed
00:00
public class LuuTru {
    public boolean LuuFile(Object obj, String filePath) throws Exception {
        ObjectOutputStream oos = null;
        oos = new ObjectOutputStream(new FileOutputStream(filePath));
        oos.writeObject(obj);  
        oos.flush();
        oos.close();
        return true;
    }
    public Object DocFile(String filePath) throws Exception {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filePath));
        Object o = ois.readObject();
        ois.close();
        return o;
    }
}
 

saving score / loading statistics ...