Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the code fragment args) ( 4. public static void main (String boolean opt t

ID: 3906846 • Letter: G

Question

Given the code fragment args) ( 4. public static void main (String boolean opt true ; switch (opt) ( 7 case true: System.out.print ("True") break; 10. default: System.out.print ("**"); 12. 13. 14. System. out.println ("Done") Which modification enables the code fragment to print TrueDone? A. Replace line 5 With String opt"true", Replace line 7 with case "true". B. Replace line 5 with boolean optl Replace line 7 with case 1- C. At line 9, remove the break statement. D. Remove the default section.

Explanation / Answer

Option A :

Change the boolean variable to String and intialize it with "true".

This modification will ensure that True is printed from case "true" and Done from default