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

📄 main.java

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

class Main {
    public static void main(String[] args) {
        // some code that captures output from 'ls'
        try {
            String cmd = "ls";
            Process child = Runtime.getRuntime().exec(cmd);

            // Wait for child to finish
            try {
                child.waitFor();
            } catch (InterruptedException e) {
            }
            // Display exit status of subprocess
            int status = child.exitValue();
            if (status == 0)
                System.out.println("process successfully completed.");
            else
                System.out.println("process exited with " + status);
        } catch (IOException e) {
            System.err.println(e);
        }
    }
}

⌨️ 快捷键说明

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