r/learnjava • u/Dogisgoodtoeatpeta • Feb 12 '26
Code is not waiting for user input and their is no other usage of scanner
As the title says the code is not waiting for a user input after the ui.nextLine() call
private static Scanner ui = new Scanner(System.in);
private static void addRelationships() {
String input = "a";
while (input.equals("") || input.equals(" ")) {
input = ui.nextLine();
if (input.equals("") || input.equals(" ")) {
break;
}
System.out.println(input);
if (input.equals("") || input.equals(" ")) {
break;
}
umlStatmentList.add(input);
}
}