I have a small program to scan an Integer from console, also I would like to use new line character as delimiter.
import java.util.Scanner;
public class TestScanner {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in).useDelimiter("\n");
System.out.println("Enter the int");
int testInt = scanner.nextInt();
System.out.println(testInt);
}
}
Intellij runs and exist normal way..
Where as Eclipse produce, java.util.InputMismatchException
In Run mode you can observe an exception, with debug mode, code will run with out any issues
Source : jdk1.8.0_161 ( Oracle )
This is strange. Kindly help me to understand how this can be corrected. Thanking you!