Hey all,
Just looking for some help with the switch statement. I'm pretty new to Java, having only picked it up this September for a course. Looking for this line of code to output either a "Correct!" or "Incorrect!" answer depending on what the user inputs
` // Q2: relational operators, switch statement
int num4 = 7, num5 = 5, num6 = 4;
System.out.println("Question 2: Is the expression 7 > 5 && 4 <= 4 false?"); //result = true, 1
System.out.println("A. True ");
System.out.println("B. False ");
System.out.println("C. None of the above ");
System.out.println("Your answer: ");
char answer2 = scanner.next().charAt(0);
//evaluate answer using switch statement
boolean value1 = 7 > 5 && 4 <= 4;
switch (answer2){
case 'A':
System.out.println("Correct! ");
score +=1;
break;
case 'B':
System.out.println("Incorrect! The answer is A");
break;
case 'C':
System.out.println("Incorrect! The answer is A ");
break;
}`