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
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.