阿摩線上測驗 登入

試題詳解

試卷:104年 - SCJP 51-100#99391 | 科目:OJCP(SCJP)

試卷資訊

試卷名稱:104年 - SCJP 51-100#99391

年份:104年

科目:OJCP(SCJP)

56. Given: 
5. class Building{}
 6. public class Barn extends Building{ 
7. public static void main(String[] args){ 
 8. Building build1 = new Building();
 9. Barn barn1 = new Barn(); 
10. Barn barn2 = (Barn)build1; 
11. Object obj1 = (Object)build1; 
12. String str1 = (String)build1; 
13. Building build2 = (Building)barn1; 
14. } 
15. } 
Which is true?
(A) if line 10 is removed, the compilation succeeds.
(B) if line 11 is removed, the compilation succeeds.
(C) if line 12 is removed, the compilation succeeds.
(D) if line 13 is removed, the compilation succeeds.
(E) More than one line must be removed for compilation to succeed.
正確答案:登入後查看