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

📄 main.java

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

class Main {
    public static void main(String[] args) {
        if (args.length != 1) {
            System.err.println("Usage: java Main <input_file>");
            System.exit(-1);
        }
        try {
            File f = new File(args[0]);
            FileInputStream in = new FileInputStream(f);
            long size = f.length();          // Get size of file.

            in.skip(size/2);               // Skip half the file.

            int c;
            while ((c=in.read()) > -1)      // Echo the rest.
                System.out.print((char)c);
            
            in.close();                     // Close it.
            System.out.flush();
        } catch (FileNotFoundException e) {
            System.err.println(args[0] + " is not found");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

⌨️ 快捷键说明

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