Select the correct options based on the code below
public class Main { // line 1 public static void main(String[] args) { // line 2 int num1 = 12; // line 3 float num2 = 17.8f; // line 4 boolean isTrue = true; // line 5 boolean returnVal = num1 >= 12 && num2 < 4.5 // line 6 || isTrue == true; System.out.println(returnVal); // line 7 } // line 8 } // line 9 a Code prints false b Code prints true c Code will print true if code on line 6 is modified to the following: boolean returnVal = (num1 >= 12 && num2 < 4.5) || isTrue == true; d Code will print true if code on line 6 is modified to the following: boolean returnVal = num1 >= 12 && (num2 < 4.5 || isTrue == false);
B, C
A is incorrect because the code prints true.
D is incorrect because the code prints false.
public class Main { public static void main(String[] args) { int num1 = 12; float num2 = 17.8f; boolean isTrue = true; boolean returnVal = num1 >= 12 && num2 < 4.5 || isTrue == true; System.out.println(returnVal); } }
The code above generates the following result.