nerdexam
Oracle

1Z0-805 · Question #77

Given: public class StringApp { public static void main(String[] args) { String[] str="Java SE,java EE,Java ME,java FX".split(","); int count=0; for(int i=0;i<str.length;i++) { switch(str[i]) { case…

The correct answer is B. 2. Java SE and Java ME will increase the count variable as it matches. java EE and java FX does not match.

Advanced Class Design

Question

Given:

public class StringApp { public static void main(String[] args) { String[] str="Java SE,java EE,Java ME,java FX".split(","); int count=0; for(int i=0;i<str.length;i++) { switch(str[i]) { case "Java SE":

count++; continue; case "Java EE":

count++; break; case "Java ME":

count++; break; case "Java FX":

Oracle 1Z0-805 Exam count++; break; } } System.out.println("Total match found="+count); } } What is the result?

Options

  • A1
  • B2
  • C3
  • D4

How the community answered

(62 responses)
  • A
    15% (9)
  • B
    76% (47)
  • C
    6% (4)
  • D
    3% (2)

Explanation

Java SE and Java ME will increase the count variable as it matches. java EE and java FX does not match.

Topics

#switch on String#continue statement#break statement#control flow

Community Discussion

No community discussion yet for this question.

Full 1Z0-805 Practice