2006-02-06, 08:00 PM
Pages: 1 2
2006-02-06, 08:33 PM
That's why I said the *relevant* source code, not the entire one. ;) My guess is that you assign the input directly to an integer variable though it gets read as a string. Maybe your Windows JVM automatically converts the input. But show me the source, Luke. :)
2006-02-07, 03:00 AM
here it is the menu part
Code:
/Main Menu
System.out.println ("Please select a option");
System.out.println ("1. Play Game");
System.out.println ("2. Instructions");
System.out.println ("3. High Scores");
System.out.println ("4. Exit");
intInput = reader.readInt();
//Menu Choices
if (intInput == 1){
PlayGame();
}else if (intInput == 2){
strInstructions();
}else if (intInput == 3){
HighScores();
}else if (intInput == 4){
}
2006-02-07, 05:52 PM
The data type of your "reader" variable would be interesting, too. I just wrote a small example that *should* work (will test it later, not too much time at the moment):
Code:
import java.io.*;
public class myinput {
static public void main(String[] args) {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int someint = 0;
System.out.print("Number: ");
try {
someint = Integer.parseInt(reader.readLine());
} catch (IOException e) {
System.out.println("Input error...");
System.exit(1);
}
System.out.println("Entered "+someint+".");
}
}
Pages: 1 2