nerdexam
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)
  • A
    9% (3)
  • B
    85% (29)
  • C
    3% (1)
  • F
    3% (1)

Community Discussion

No community discussion yet for this question.

Full 1Z0-851 Practice