Dustin Schreader wrote:Not really sure what I'm doing wrong here.
Well your title asks about
readLine(), but you're running
read().
If you want the first, you have to to wrap
System.in in a BufferedReader:
BufferedReader keyboard =
new BufferedReader(new InputStreamReader(System.in));
A bit ugly, I know (I wish
Java would fix that).
readLine() also returns a
String, so you need to pull the first character from it:
cmd = keyboard.readLine().charAt(0);
It should be noted that with
readLine(), the character won't be read until you press the Enter key.
Another alternative, popular with beginners, is java.util.Scanner.
Winston