关于异常以及如何把文件输出到AWT的界面
编译代码如下,但是再运行的时候却出现异常.另外,有什么方法可以把文件从窗口的界面上输出来?import java.io.*;
class ObjectTo{
public static void main(String[] args) throws Exception{
booker e1=new booker("zhangsan","1234","某 某 某 某 某","6月13日","hello","12");
booker e2=new booker("lisi","5678","某 某 某 某 某","7月8日","goodbye","21");
FileOutputStream al=new FileOutputStream("F:\\1.txt");
ObjectOutputStream bl=new ObjectOutputStream(al);
bl.writeObject(e1);
bl.writeObject(e2);
bl.close();
FileInputStream cl=new FileInputStream("F:\\1.txt");
ObjectInputStream dl=new ObjectInputStream(cl);
booker e;
for (int i=0;i<=2;i++){
e=(booker)dl.readObject();
System.out.println(e.courman+":"+e.telephone+" "+e.people+" "+e.time+" "+e.topic+" "+e.num);
}
}
}
class booker implements Serializable{
String courman,telephone,people,time,topic,num;
public booker(String courman,String telephone,String people,String time,String topic,String num){
this.courman=courman;
this.telephone=telephone;
this.people=people;
this.time=time;
this.topic=topic;
this.num=num;
}
}