So I wanna read input from standard input and I'm using Scanner.
private static String readInput(Scanner input) throws java.io.IOException {
String line = null;
try {
while (input.hasNextLine()) {
line = input.nextLine();
}
input.close();
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println(line);
return line;
}```
But this is not exactly achiving my goal. I wanna read few/multiple lines of sentences. Then I wanna work with this but this only reads line by line so that is the problem. Obviously I will implement a stringbuilder but the problem I am having rn is I don't how or when to terminate. If I was reading a file then I will read until there are no more lines but what do I do here?