?? replacetest.java
字號:
import java.io.*;
import java.util.*;
/**
* Description:
* <br/>Copyright (C), 2005-2008, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class ReplaceTest
{
public static void main(String[] args)
{
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
try
{
//創(chuàng)建一個ObjectOutputStream輸入流
oos = new ObjectOutputStream(
new FileOutputStream("replace.txt"));
Person per = new Person("孫悟空", 500);
//系統(tǒng)會將per對象轉(zhuǎn)換字節(jié)序列并輸出
oos.writeObject(per);
//創(chuàng)建一個ObjectInputStream輸入流
ois = new ObjectInputStream(
new FileInputStream("replace.txt"));
ArrayList list = (ArrayList)ois.readObject();
System.out.println(list);
}
catch (Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if (ois != null)
ois.close();
if (oos != null)
oos.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -