Hello I need to write a program that accepts yes or no or y and n. Ignoring cases.
I have got this far and. I don’t understand why my else if statement isn’t working
import java.util.Scanner;
public class Page191Q3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
// Suppose you are writing a program that asks the user a yes or no question. Store answer in Stringvariableresponce.
boolean accept = false;
Scanner keyboard = new Scanner(System.in);
System.out.println(“Yes or No?”);
String response;
response = keyboard.nextLine();
if( response.equalsIgnoreCase(“yes”) || response.equalsIgnoreCase(“Y”) ); {
accept = true;
}
else if( response.equalsIgnoreCase(“no”) || response.equalsIgnoreCase(“n”) ); {
accept = false;
}else{
System.out.println(“You made a mistake”);
}
}
}