GradePack

    • Home
    • Blog
Skip to content

What is the output of the following code fragment if the inp…

Posted byAnonymous July 9, 2026

Questions

Whаt is the оutput оf the fоllowing code frаgment if the input is 6? int i; System.out.print("Enter а value for i > "); Scanner sc = new Scanner(System.in); i = sc.nextInt(); switch(i) {   case 4: i = i + 3;   case 3:   case 1: i = i + 1;   case 6: break;   case 7: i = i + 2;           break;   case 8: i = i + 2;    default: i = i + 1; } System.out.println(i);

Tags: Accounting, Basic, qmb,

Post navigation

Previous Post Previous post:
A soccer player transitions instantly from a light jog to an…
Next Post Next post:
Convert the following if-else-if statement to its equivalent…

GradePack

  • Privacy Policy
  • Terms of Service
Top