1Z0-808 Web TestEngine demo

Exit VCEDump 1Z0-808 Java SE 8 Programmer I
Question 54 of 58
0% complete
Q54 Single choice

Given the code fragment:

String[] cartoons = {"tom","jerry","micky","tom"};

int counter =0;

if ("tom".equals(cartoons[0])) {

counter++;

} else if ("tom".equals(cartoons[1])) {
counter++;

} else if ("tom".equals(cartoons[2])) {

counter++;

} else if ("tom".equals(cartoons[3])) {

counter++;

}

System.out.print(counter);

What is the result?

Sign in to mark questions

Sign in to save marked questions and return to this demo.

Sign in