🔍
📢

Java 最简实例

vim hi.java


public class Hi {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}


执行:java hi.java

输出:Hello, World!


Java Shell脚本( Java 11+):

#!/usr/bin/env java --source 11

public class Hi {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}


执行:./hello.sh

输出:Hello, World!