Although others suggest using Scanner#nextInt
I wouldn't recommend it. It has some kind of nonintuitive behavior and causes harm when used by programmers who are new to Java when trying to read first number, the operator and the second number.
As the OP is already familiar with Scanner#nextLine
I would suggest the following approach:
Scanner sc = new Scanner(System.in);
String a = sc.nextLine();
String b = sc.nextLine();
int first = Integer.parseInt(a);
int second = Integer.parseInt(b);
int result = first+second;
To design such quiz, I would suggest going a bit further:
public static void main(String[] args) {
Random random = new Random();
Scanner sc = new Scanner(System.in);
int a = random.nextInt(100);
int b = random.nextInt(100);
System.out.println(String.format("What is the result of %d + %d", a, b));
String answer = sc.nextLine();
try {
int result = Integer.parseInt(answer);
if (result == a+b) {
System.out.println("Correct");
} else {
System.out.println("Wrong");
}
} catch (NumberFormatException e) {
System.out.println(answer + " - is not a valid number");
}
}