Can anybody understand why this is saying that the numbers are being added up incorrectly. I have double checked the input numbers and what is outputted and it does the sum correctly. Pls help.
package en.codegym.task.pro.task04.task0403;
import java.util.Scanner;
/*
Summation
*/
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String line = "hello";
int n1 = 0;
int n2 = 0;
int sum = 0;
boolean isENTER = false;
while (!isENTER)
{
if (scanner.hasNextInt()){
n1 = scanner.nextInt();
n2 = scanner.nextInt();
sum = n1;
sum = sum + n2;
System.out.println(sum);
}
else if(scanner.hasNextLine()){
line = scanner.nextLine();
}
if (line.equals("ENTER")) {
isENTER = true;
}
}
}
}