Bad thing about knowing a few languages, you have a tendacy to get them mixed up. Such is this case (I hope).
why does this always produce a "N"
its a yes/no question - basically if a user enters a y regardless of case or a empty (by just hitting enter) it will mean they entered yes, if anthing else, its no. whenever i put a y or a Y in it, it yeilds a N.
whats wrong with this code?
Code:
tmpStr = JOptionPane.showInputDialog("Would you like to select your \nown terminal velocity?[Y/n]: ");
if (user_ans=="" || user_ans=="Y"|| user_ans=="y"){
user_ans="Y";
}else{user_ans="N";};
its a yes/no question - basically if a user enters a y regardless of case or a empty (by just hitting enter) it will mean they entered yes, if anthing else, its no. whenever i put a y or a Y in it, it yeilds a N.
whats wrong with this code?
Comment