Friday, 3 February 2012

Question 124 : Operators

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.

No comments:

Post a Comment