What is the result?

Given:

3. public class Batman {
4. int squares = 81;
5. public static void main(String[] args) {
6. new Batman().go();
7. }
8. void go() {
9. incr(++squares);
10. System.out.println(squares);
11. }
12. void incr(int squares) { squares += 10; }
13. }

What is the result?

Given:

3. public class Batman {
4. int squares = 81;
5. public static void main(String[] args) {
6. new Batman().go();
7. }
8. void go() {
9. incr(++squares);
10. System.out.println(squares);
11. }
12. void incr(int squares) { squares += 10; }
13. }

What is the result?

A.
81

B.
82

C.
91

D.
92

E.
Compilation fails.

F.
An exception is thrown at runtime.



Leave a Reply 0

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