WriteTeacherObj

package JBJADV003;
import java.io.*;
public class WriteTeacherObj {

/**
* @param args
*/
public static void main(String[] args)throws FileNotFoundException, IOException {
ObjectOutputStream oos=null;
try{
//创建ObjectOutputStream输出流
oos=new ObjectOutputStream(new FileOutputStream("c:\\myDoc\\tea.txt"));

Student stuZhang=new Student("韩冰",22,"女","123456");
Teacher teacherWang=new Teacher("王老师",stuZhang);
Teacher teacherLi=new Teacher("李老师",stuZhang);

//对象序列化,写入输出流
oos.writeObject(stuZhang);
oos.writeObject(teacherWang);
oos.writeObject(teacherLi);
}catch(IOException ex){
ex.printStackTrace();
}finally{
if(oos!=null){
oos.close();
}
}

}

}

上一篇:Spark记录-实例和运行在Yarn


下一篇:土旦:关于display:flex碰上white-space nowrap 影响布局的问题