Exam Permalink:
https://www.jobilize.com/java-certification-questions
Question Permalink:
https://www.jobilize.com/java-switch-statement-syntax
Question 70 / 297:  Which of the following is correct after running this code ?
Choose 2
public class Tester {

public static void main(String[] args) {

char code = 'a';

for (int i = 1; i <= 10; i++) {

switch (i) {

case 5: {

System.out.println("match");

}

default: {

System.out.println("default");

}

}

}

}

}

<< First < Previous Next > Last >>
Explanation:

Printing “match” will be executed only when i reaches value 5. default will be executed in all cases even when i reaches value 5 since there is no break statement

Exam Home Page
https://www.jobilize.com/java-certification-questions

Oracle Certified Professional Java Programmer

Author:

Access: Public Instant Grading

Ask
Madison Christian
Start Test
Brenna Fike
Start Quiz
Keyaira Braxton
Start Exam
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>