-4
package trying;
import java.util.Scanner;
public class calculation {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int a=input.nextInt();
int b=input.nextInt();
int d=a+b;
System.out.println(d);
}
}
您可以通过命令行运行它。尝试谷歌搜索,如_how通过命令行_运行一个Java程序。或者参见[如何运行一个java程序 - 从命令行](http://stackoverflow.com/questions/16137713/how-to-run-a-java-program-from-命令行) – pzaenger
这将甚至编译和启动你的类http://stackoverflow.com/a/37745811/1997376 –
看看这个:http://stackoverflow.com/questions/2360995/how-do -i-compile-and-run-a-program-in-java-on-my-mac – Marco