Skip to content

Keyboard input issue with iJava in MacOS 10.13.6 #21

@sesh1989

Description

@sesh1989

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions