Try to do like this next time :)
First import our fine scanner from java's own library, util!
import java.util.*;
Afterward declare the class name
public class NewClass {
Second after that our scanner !
static Scanner s = new Scanner(System.in);
static represents it to be able use different values in different times however you will not be able to change the same value since it will be declared for every the same as you did from start.(Someone else tell him/her in a better way please :>)
Third the main !
public static void main(String[] arg) {
The program itself !
System.out.println("First value");
int X = s.nextInt();
System.out.println("Second value");
int Y = s.nextInt();
int sum = X+Y;
System.out.println("First value + second value equals "+sum);
}
}
So the whole code will look like this !
import java.util.Scanner;
public class Test {
static Scanner s = new Scanner(System.in);
public static void main(String[] arg) {
System.out.println("First value");
int X = s.nextInt();
System.out.println("Second value");
int Y = s.nextInt();
int sum = X+Y;
System.out.println("First value + second value equals "+sum);
}
}
Enjoy :)