When I type in yes it come out with all the text in the yes if statement plus TEXT4(the last if statement). Can some one spot the error? I also tried if ( ! (answer.equals(All)) ) it still comes out with TEXT4....
public static void main(String args[]){ String answer1; String yes = "yes"; String no = "no"; String[] All = {"yes", "no"}; Scanner answer = new Scanner(System.in); System.out.println("TEXT1"); System.out.println("yes/no"); answer1 = answer.nextLine(); answer1.toLowerCase(); if(answer1.equals(yes)){ System.out.println("TEXT2"); } if(answer1.equals(no)){ System.out.println("TEXT3"); System.out.println("yes/no"); } if (!answer.equals(yes)&&!answer.equals(no)){ System.out.println("TEXT4"); } }