Answer the question
In order to leave comments, you need to log in
How to organize the input of lines from the console until the word end is found in some line?
An array of strings is declared.
Please tell me how to organize the input from the console lines to a certain word. So that the rest of the lines are filled with numbers = line number.?
Answer the question
In order to leave comments, you need to log in
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
while (true) {
String S = sc.nextLine();
if(S.equals("end")) {
break;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question