Conditional code not working
/*Hi. I'm trying to implement the execution of a line of code based on the condition that the variable 'searchChoice' is not equal to "y" and also not equal to "n", but even when the variable is not equal to either "y" or "n", the code still runs and "invalid input!!" gets displayed. The below is the problematic code. Your assistance is appreciated. "*/ do{ System.out.println("Enter \'y\' for \'yes\' and \'n\' for \'no\'"); searchChoice = s.nextLine().toLowerCase(); if((searchChoice != "y") & (searchChoice !="n")){ System.out.println("invalid input!!"); isCorrectInput=false; } } while(!isCorrectInput);