I may have been staring at this too long, but why isn't my keyboard input being read?
package com.codegym.task.task07.task0722;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/*
The end
1. Declare a string list variable and immediately initialize it.
2. Read strings from the keyboard and add them to a list until the user enters "end".
3. Do not add "end" to the list.
4. Display the list, each value on a new line.
5. Use a for loop.
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
//write your code here
ArrayList<String> list = new ArrayList<>();
//String temp;
while (true) {
String temp;
if (br.readLine().equals("end")) {
break;
} else {
temp = br.readLine();
list.add(temp);
}
}
for (String s : list) {
System.out.println(s);
}
}
}