目的: 保存序列化類到文件
概念: 序列化類: 所謂序列化類
代碼: Test_Ser
import java
import java
public class Test_Ser
{
public static void main(String[] args) throws Exception
{
Vector v = new Vector(); // 生成一個向量表
v
FileOutputStream ostream = new FileOutputStream(
ObjectOutputStream p = new ObjectOutputStream(ostream);// 綁定
p
p
p
ostream
v
FileInputStream istream = new FileInputStream(
ObjectInputStream pr = new ObjectInputStream(istream); // 綁定
v = (Vector)pr
istream
System
System
}
}
說明:Vector類是繼承了Serializable接口的
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25554.html