I have a requirement where I will have to read inputs from console not from file
The input format is as below.I understand I can use any character to exit .But i cannot give any other input than this.Can i write some thing like wait for a specific amount of time and if there is no input break the loop or else what else can be done to read input whose length we never know before hand.
Hello,Agnes
Minion,Bedo
Vector,Shrink Ray
This following logic will make the readline wait forever for the input and wouldn't help because every enter I press will again be another input character and it never ends.
I neither wanna give any exit character to determine end of input like "exit". How to handle this??
ArrayList<String> emp=new ArrayList<String>();
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
h=br.readLine();
while((h=br.readLine()) != null)
{
emp.add(h);
}