Oracle
1Z0-851 · Question #135
Given: public class Batman { int squares = 81; public static void main(String[] args) { new Batman().go(); } void go() { incr(++squares); System.out.println(squares); } void incr(int squares) {…
The correct answer is B. 82. See the full explanation below for the reasoning.
Question
Given: public class Batman { int squares = 81; public static void main(String[] args) { new Batman().go(); } void go() { incr(++squares); System.out.println(squares); } void incr(int squares) { squares += 10; } } What is the result?
Options
- A81
- B82
- C91
- D92
- ECompilation fails.
- FAn exception is thrown at runtime.
How the community answered
(34 responses)- A9% (3)
- B85% (29)
- C3% (1)
- F3% (1)
Community Discussion
No community discussion yet for this question.