Given:
1. class Batman{
2. int squares = 81;
3. public static void main(String[] args){
4. new Batman().go();
5. }
6. void go(){
7. incr(++squares);
8. System.out.println(squares);
9. }
10. void incr(int squares){squares += 10;}
11. }
What is the result?
A. 81
B. 82
C. 91
D. 92
E. Compilation fails.
F. An exception is thrown at runtime.
答案:B
參考:6-2 Java 方法
沒有留言:
張貼留言