SCJP題庫第028題



1. class X{
2.   X(){System.out.print(1);}
3.   X(int x){
4.     this();
5.     System.out.print(2);
6.   }
7. }
8. public class Y extends X{
9.   Y(){
10.     super(6);
11.     System.out.print(3);
12.   }
13. Y(int y){
14.   this();
15.   System.out.prin tln(4);
16. }
17. public static void main(String[] a){new Y(5);}
18.}
What is the result?

A. 13
B. 134
C. 1234
D. 2134
E. 2143
F. 4321

Ans:C



解說:
此題follow本身建構子呼叫this()與父類別建構子呼叫super()的過程,即可跑出答案。

Comments

Popular posts from this blog

Android+Google Map API v3 Geocoding(地址轉經緯度度