就业班是一定要去的,但去之前想进基础班强化一下,谁知道刚刚过25周岁可不可以进?
另外,这论坛有个bug不知道你们发现了没有! 每次发帖子忘记选择主题分类提交被提示后都要等60秒才能再提交!
工作之余自学阶段,io流快结束了!
- /*
- ObjectStreamDemo
- */
- import java.io.*;
- public class ObjectStreamDemo {
- public static void main(String[] args) throws Exception {
- //writeObj();
- readObj();
- }
-
- public static void writeObj() throws Exception {
- File file = new File("obj.txt");
- ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));
- oos.writeObject(new Person("lisi", 39));
- oos.close();
- }
-
- public static void readObj() throws Exception {
- File file = new File("obj.txt");
- ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));
- Object obj = ois.readObject();
- System.out.println(obj);
- }
- }
- class Person implements Serializable {
- private String name;
- private int age;
-
- Person(String name, int age) {
- this.name = name;
- this.age = age;
- }
-
- public String toString() {
- return name + " : " + age;
- }
- }
复制代码 |
|