Quiz
public class quiz {
public static void main(String[] args){
Scanner input;
String no = "2";
String yes = "1";
int begin = 0;
input = new Scanner(System.in);
System.out.println("Are you ready to start the quiz?");
try {
String startQuiz = input.nextLine();
if (startQuiz == "yes"){
System.out.println("ok lets start");
}
if (startQuiz == "no"){
System.out.println("too bad");
}
} catch (Exception e) {
System.out.println("idk how you messed this up" + e);
}
input = new Scanner(System.in);
System.out.println("Question 1: Would the following result in true or false");
System.out.println("(true)");
try {
boolean a = input.nextBoolean();
if (a = true) {
System.out.println("Congrats you got it right");
} else {
System.out.println("Sorry you got it wrong");
}
} catch (Exception e) {
System.out.println("idk how you messed this up" + e);
}
}
}
quiz.main(null)