This question has already been answered:
- Read several lines in one variable 2 responses
How to count several (the number can be different and we can NOT set it) lines from the console in Java?
This question has already been answered:
How to count several (the number can be different and we can NOT set it) lines from the console in Java?
A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .
List<String> input = new ArrayList(); Scanner scan = new Scanner(System.in); while(true){ String current = scan.nextLine(); if(current.equals(""))break; input.add(current); } Input is terminated when an empty string is entered
Source: https://ru.stackoverflow.com/questions/686570/
All Articles