⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readobject.java

📁 java 完全探索的随书源码
💻 JAVA
字号:
import java.io.*;import java.util.*;// This class opens up the file "writeme" and reads two// objects from it. It makes no assumptions about the// types of the objects, it just prints them out.public class ReadObject extends Object{  public static void main(String[] args)  {    try    {      // Open an input stream to the file "writeme"      FileInputStream fileIn = new FileInputStream( "writeobject.txt" );      // Create an ObjectInput filter on the stream      ObjectInputStream objIn = new ObjectInputStream(fileIn);      // Read in the first object and print it      Object ob1 = objIn.readObject();      System.out.println(ob1);      // Read in the second object and print it      Object ob2 = objIn.readObject();      System.out.println(ob2);      // Close the stream       objIn.close();    }    catch( ClassNotFoundException ex )    {      ex.printStackTrace();    }    catch( IOException ex )    {      ex.printStackTrace();    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -