L
Les
I'm taking my second Java class right now and I'm trying to use an if/
else argument based on a user input. The values in question all could
be integers but if I set them up as int, the program crashes when
anything other than an integer is entered. So I tried using char.
But all of my if statements don't work anymore...
if (userInput == 1){
string
}
if (userInput == 2){
string
}
if ((userInput != 1)&&(userInput !=)){
string
}
and so on and so forth...
All of this is running in a while statement and as far as I can tell,
the if arguments are not reading the char value. I verified this by
placing the code System.out.println(userInput) right before the if
args started and verified that the value of variable userInput is
changing with the inputed value.
What am I missing here?
else argument based on a user input. The values in question all could
be integers but if I set them up as int, the program crashes when
anything other than an integer is entered. So I tried using char.
But all of my if statements don't work anymore...
if (userInput == 1){
string
}
if (userInput == 2){
string
}
if ((userInput != 1)&&(userInput !=)){
string
}
and so on and so forth...
All of this is running in a while statement and as far as I can tell,
the if arguments are not reading the char value. I verified this by
placing the code System.out.println(userInput) right before the if
args started and verified that the value of variable userInput is
changing with the inputed value.
What am I missing here?