"SCJP 1.6版考題 022" 修訂間的差異
出自 陳富國維基館
(新頁面: 1. class Pass{ 2. public static void main(String[] args){ 3. int x = 5; 4. Pass p = new Pass(); 5. p.doStuff(x); 6. System.out.print(" main x = " + x); 7. } ...) |
(無差異)
|
於 2013年3月30日 (六) 08:30 的最新修訂
1. class Pass{
2. public static void main(String[] args){
3. int x = 5;
4. Pass p = new Pass();
5. p.doStuff(x);
6. System.out.print(" main x = " + x);
7. }
8. void doStuff(int x){
9. System.out.println(" doStuff x = " + x++);
10. }
11.}
What is the result?
A. Compilation fails.
B. An exception is thrown at runtime.
C. doStuff x = 6 main x = 6
D. doStuff x = 5 main x = 5
E. doStuff x = 5 main x = 6
F. doStuff x = 6 main x = 5
解答
Ans: D
解說: 無
| ||||||||||||||||||||