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

📄 main.java

📁 java的经典例子
💻 JAVA
字号:
import java.io.*;
import java.util.Date;

class Main {
    public static void main(String[] args) {
        try {
            // Write 2 instances of Date
            FileOutputStream f = new FileOutputStream("Test1.ser");
            ObjectOutputStream out = new ObjectOutputStream(f);

            Date d = new Date();
            out.writeObject(d);
            out.writeObject(d);
            out.flush();
            out.close();

            // Write 2 instances of Date, separated by reset()
            f = new FileOutputStream("Test2.ser");
            out = new ObjectOutputStream(f);

            out.writeObject(d);
            out.reset();
            out.writeObject(d);
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

⌨️ 快捷键说明

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