Keyboard input issue with iJava in MacOS 10.13.6

I have written the following java program:

ArrayList <String> sArr = new ArrayList<>();
Scanner keybd = new Scanner(System.in);
for (int i = 0; ; i++)
{
    System.out.println("Type a number. Terminate by giving -99");
    String input = keybd.nextLine();
    if (input.contains("-99"))
        break;
    sArr.add(input);
}

for (String s1 : sArr)
    System.out.println(s1);

The first for loop should exit on receiving -99 from keyboard and the second for loop should print the numbers read. But, the first for loop continues to get standard input ad infinitum even after -99 is entered. A similar issue #14 is reported to be closed, but the bug seems to be rearing its ugly head still.