So basically, I'm trying to keep taking input from the user and printing it line by line, until he's done, then I'll print done. Problem is, the code works just fine until I press double Enter/Return, it's supposed to print DONE however it returns an ArrayIndexOutOfBoundsException @ 1. So what am I doing wrong?
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
while((line = br.readLine()) != null) {
String[] tmp = line.split(" ");
System.out.println(tmp[0] + " " + tmp[1]);
}
System.out.println("DONE");