Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
switch statement
:
Content language: English
Русский
What is the following program output: class Main { public static void main(String[] args) { switch (new Integer(4)) { case 4: System.out.println("4"); break; default: System.out.println("default"); } } }
switch statement
What will be the result of the following code compilation and execution? public class Switch { public static void main(String[] args) { int i = 3; switch(i) { default: System.out.println("default"); case 1: System.out.println("1"); case 2: System.out.println("2"); } } }
switch statement
What is the result of the following code compilation and execution? switch(10) { case 1: System.out.println("1"); break; case 2: System.out.println("2"); break; default: break; System.out.println("default"); }
switch statement
What will be the result of the following code execution? for(int i = 0 ; i < 4 ; ) { switch(new Integer(i++)) { case 1: System.out.print("one "); break; case 3: System.out.print("three "); case 4: System.out.print("four "); default: System.out.print("def "); } }
switch statement
What is the result of the following program execution? public class Main { public static void main(String[] args) { final Integer i = 1; switch (1) { case i: System.out.println("1"); break; default: System.out.println("default"); } } }
switch statement
What will be printed into console after executing next piece of code: public class Test { public void checkCase(int i) { switch (i&01) { case 1: System.out.println("Case 1"); case 2: System.out.println("Case 2"); default: System.out.println("Default"); case 3: System.out.println("Case 3"); } } public static void main(String[] args) { Test test = new Test(); test.checkCase(-1); } }
switch statement
What will be the result of compilation and execution of the following code: public class Test { public static void main(String[] s){ long c = 1; switch(c) { case 1: c = 3; break; case 3: c = 4; break; } System.out.println(c); } }
switch statement
Break statement
switch statement
Break statement
switch statement
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes