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);
}
}
Asked
Active
Viewed 133 times
-4
-
1You can run it via command line. Try a google search, like _how to run a java program via command line_. Or see [how-to-run-a-java-program-from-the-command-line](http://stackoverflow.com/questions/16137713/how-to-run-a-java-program-from-the-command-line) – pzaenger Jun 13 '16 at 09:40
-
this will even compile and launch your class http://stackoverflow.com/a/37745811/1997376 – Nicolas Filotto Jun 13 '16 at 09:41
-
2Take a look at this: http://stackoverflow.com/questions/2360995/how-do-i-compile-and-run-a-program-in-java-on-my-mac – Marco Jun 13 '16 at 09:41
-
compile by ``javac calculation.java`` and to run ``java calculation`` at terminal – rev_dihazum Jun 13 '16 at 09:41
-
1For the future try to google it at least ^^ – Marcel Jun 13 '16 at 09:42
1 Answers
0
First one should compile the java by using this command:
javac calculation.java
As second step one would run the program with this command:
java calculation
for a more detailed version of this answere i'll refer to the duplicate post: How do I compile and run a program in Java on my Mac?