Here's some code I used in my assignments to handle user input.
It only covers strings and integers, but it's a lot nicer to use
than the standard libraries or tcdIO.
import java.io.*;
public static String readString(String prompt)
{
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
String input = "";
boolean done = false;
while (!done) {
try {
if (prompt != null)
System.out.print(prompt);
input = br.readLine();
if (input.length() > 0)
done = true;
}
catch (Exception e) { input = null; }
}
return input;
}
public static int readInt(String prompt)
{
String input;
int result;
try {
input = readString(prompt);
result = Integer.parseInt(input);
}
catch (Exception e) { result = -1; }
return result;
}