Oracle
1Z0-803 · Question #126
1Z0-803 Question #126: Real Exam Question with Answer & Explanation
The correct answer is A: 1. See the full explanation below for the reasoning.
Question
Given the code fragment: String[] cartoons = {"tom", "jerry", "micky", "tom"}; int counter = 0; And, 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?
Options
- A1
- B2
- C4
- D0
Community Discussion
No community discussion yet for this question.