进阶day10-.static和transient在序列化中的区别与作用
This commit is contained in:
@@ -21,7 +21,7 @@ public class Demo11 {
|
||||
Student s = new Student("张三", 20);
|
||||
|
||||
//序列化:将java对象保存到文件中
|
||||
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("student.txt"));
|
||||
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("student2.txt"));
|
||||
oos.writeObject(s);
|
||||
|
||||
oos.close();
|
||||
|
||||
Reference in New Issue
Block a user