-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);

    }

}
zakinster
  • 10,508
  • 1
  • 41
  • 52
  • 1
    You 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
  • 2
    Take 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
  • 1
    For the future try to google it at least ^^ – Marcel Jun 13 '16 at 09:42

1 Answers1

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?

Community
  • 1
  • 1
Baklap4
  • 3,914
  • 2
  • 29
  • 56