代码
2009-02-11 17:39
190 查看
public class TransientTest { public static void main(String[] args) { LabeledPoint label = new LabeledPoint("Book", 5.00, 5.00); try { System.out.println(label);//写入前 ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream("Label.txt")); out.writeObject(label); out.close(); System.out.println(label);//写入后 ObjectInputStream in = new ObjectInputStream(new FileInputStream("Label.txt")); LabeledPoint label1 = (LabeledPoint)in.readObject(); in.close(); System.out.println(label1);//读出并加1.0后 } catch (Exception e) { e.printStackTrace(); } } }}
public class TransientTest
{
public static void main(String[] args)
{
LabeledPoint label = new LabeledPoint("Book", 5.00, 5.00);
try
{
System.out.println(label);//写入前
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream("Label.txt"));
out.writeObject(label);
out.close();
System.out.println(label);//写入后
ObjectInputStream in = new ObjectInputStream(new
FileInputStream("Label.txt"));
LabeledPoint label1 = (LabeledPoint)in.readObject();
in.close();
System.out.println(label1);//读出并加1.0后
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
相关文章推荐
- 从用例到代码
- PHP 杂谈《重构-改善既有代码的设计》之二 对象之间搬移特性
- 争取 exception-safe code(异常安全代码)
- 开源中国iOS客户端学习——(九)代码片段之时间标记
- 这段js代码请高人指点一下
- 代码重构调试问题集合
- PHP控制网页过期时间的代码!
- json的键名为数字时的调用方式(示例代码)
- strcat()函数的伪代码 --转自百度百科
- Linux内核源代码分析-第二章 代码初识-1
- eclipse自动去除无效引用、去除无效变量和自动格式化代码
- CLIP PATH (MASK) GENERATOR是一款在线制作生成clip-path路径的工具,可以直接生成SVG代码以及配合Mask制作蒙板。
- FCK常用Js,获取FCK内容,统计FCK字数,向FCK写入指定代码
- 微软一站式示例代码库新功能:提供带个示例代码下载和最新示例代码索引
- 200多个js技巧代码
- 如何防止代码腐烂
- 随手小代码——最大子数组 分治法
- 基于Jquery代码实现手风琴菜单
- Hive代码组织及架构简单介绍
- idea代码调试debug