本帖最后由 魏亮 于 2012-10-23 10:46 编辑
- import java.io.*;
- class ObjectStream
- {
- public static void main(String[] args) throws Exception
- {
- writeUTF();
- }
- public static void writeUTF() throws Exception
- {
- ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("ObjectUTF.txt"));
- oos.writeUTF("三防旅馆");
- ObjectInputStream ois = new ObjectInputStream(new FileInputStream("ObjectUTF.txt"));
- String line = ois.readUTF();
- System.out.println(line);
-
- }
- }
复制代码 编译没有错误,一执行就会报边的异常,我这个用wirteUFT()写,用readUTF读,应该没什么问题呀??问题出在哪,请指教
|
|