public class Solution { public static void main(String args[]) { int i = 2; switch(i) { case 1: System.out.print("Case 1" + " "); break; case 2: System.out.print("Case 2" + " "); break; case 3: System.out.print("Case 3" + " "); break; default: System.out.print("Default" + " "); } } } Options: Pick one correct answer from belowCase 1DefaultCase 2 Case 3 Case 4Case 2
Question
public class Solution { public static void main(String args[]) { int i = 2; switch(i) { case 1: System.out.print("Case 1" + " "); break; case 2: System.out.print("Case 2" + " "); break; case 3: System.out.print("Case 3" + " "); break; default: System.out.print("Default" + " "); } } } Options: Pick one correct answer from belowCase 1DefaultCase 2 Case 3 Case 4Case 2
Solution
The correct answer is "Case 2".
Similar Questions
Select the correct answerWhat will be the output of the following code?int b = 7;switch (b) { case 6: System.out.println("Six"); break; case 7: System.out.println("Seven"); break; case 8: System.out.println("Eight"); break; default: System.out.println("Default");}OptionsEightSevenSixDefault
What will be the output of the following code?public class Solution { public static void main(String args[]) { int i = 5; switch(i) { case 1: System.out.print("Case 1" + " "); break; case 2: System.out.print("Case 2" + " "); break; case 3: System.out.print("Case 3" + " "); break; default: System.out.print("Value of i is greater than 3" + " "); } } }Options: Pick one correct answer from belowCase 1Case 2Case 3Value of i is greater than 3PrevSubmit MCQNext
What is the output of following code:void main(){int i=5;switch(i){case 3: printf(“three”);case 4: printf(“four”);case 5: printf(“five”);case 6: printf(“six”);break;case 7: printf(“seven”);default: printf(“default”);}}a.fiveb.fivesixsevendefaultc.fivesixd.fivesixseven
What will be the output of the following program?#include<stdio.h> int main() { int i=4; switch(i) { default: printf("This is default."); case 1: printf("This is case 1"); break; case 2: printf("This is case 2"); break; case 3: printf("This is case 3"); } return 0; }Select one:This is default.This is case 1This is case 3This is default.This is case 1
Given1. class Program{2. 3. public static void main(String args[]){4. 5. final String s = "JAVA";6. 7. switch(s){8. case "JAVA" : {System.out.print("A");}9. case "java" : {System.out.print("B");}10. case default : System.out.print("default"); break;11. }12. }13. } Which is the output could be?*Compilation fails due to error at line 10.Compilation fails due to error at line 7.ABdefaultCompilation fails due to error at line 8.A
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.