I have to take inputs until EOF (white space or end of line). For example:
1
2
3
4
// end of taking input
I'm using Scanner
to take inputs. I tried this solution.
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
ArrayList<String> password = new ArrayList<>();
String input;
while (!(input = sc.nextLine()).equals("")) {
password.add(input);
}
boolean[] lengthValidation = lengthCheck(password);
boolean[] passwordContainCheck = containCheck(password);
print(lengthValidation, passwordContainCheck);
}
I can't use this, due to uri does not take it variant of answer
while(true) {
String input = sc.nextLine();
if (input.equals(""))
break;
}