What is the result?

Given:
<code>
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”:
count++; break;
}
System.out.println(“Total match found=”+count);
}
</code>
What is the result?

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":
count++; break;
}
System.out.println("Total match found="+count);
}

What is the result?

A.
1

B.
2

C.
3

D.
4

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



Leave a Reply 0

Your email address will not be published. Required fields are marked *