请教定义实体类的问题 可串行化,就是这个类的对象可以写成数据流,以便保存或转输。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 能举个例子吗分都给你! 多谢了 /* 你可以把你的user实例写到文件中 */ObjectOutputStream objout = null; FileOutputStream fileout=null; try{ File file = new File("D:/websrc/upload/11111111"); System.out.println(file.exists()); fileout = new FileOutputStream("D:/websrc/upload/11111111",true); objout = new ObjectOutputStream(fileout); } catch(Exception e){ System.out.println("can not get the outputstream"); } try{ objout.writeObject(new user());/* 你的user类*/ fileout.flush(); } catch(Exception e){ System.out.println("write error"); } try{ fileout.close(); } catch(Exception e){} // (new ObjectSave()).ReadData(); } 关于java反射机制 Java处理大文件的问题 JFreeChar无法生成class文件 求解 请问<bean:write>拿属性时怎样传个参数呢? Java如何设定系统时间 能运行HelloWorld但是不能运行Receive呢,提示:Exception in thread "main" java.lang.NoClassDefFoundError(60分!) 有关Swing中paint的设置背景色问题 怎样打开一个已存在的文件? 实习一个月终于回到学校..很高兴...散分..... 在JAVA中,怎么将用户绘制的图形用XML解释 文件读写异常??
分都给你! 多谢了
ObjectOutputStream objout = null;
FileOutputStream fileout=null;
try{
File file = new File("D:/websrc/upload/11111111");
System.out.println(file.exists());
fileout = new FileOutputStream("D:/websrc/upload/11111111",true);
objout = new ObjectOutputStream(fileout);
}
catch(Exception e){
System.out.println("can not get the outputstream");
}
try{
objout.writeObject(new user());/* 你的user类*/
fileout.flush();
}
catch(Exception e){
System.out.println("write error");
}
try{
fileout.close();
}
catch(Exception e){}
// (new ObjectSave()).ReadData();
}