您当前的位置: 首页 > 

OCJP 考试题之八

发布时间:2017-01-17 15:18:58 ,浏览量:0

OCJP视频课堂,具体讲解:https://edu.csdn.net/course/detail/7811

QUESTION 139

Giventhe following directory structure: bigProject |--source | |--Utils.java ||--classes |-- And the following command line invocation: javac -d classessource/Utils.java Assume the current directory is bigProject, what is theresult?

A.   If the compile is successful, Utils.class is added to thesource directory.

B.   The compiler returns an invalid flag error.

C.   If the compile is successful, Utils.class is added to theclasses directory.

D.   If the compile is successful, Utils.class is added to thebigProject directory.

Answer: C

Section: (none)

QUESTION 155

Given:

10. interface Data { public voidload(); }

11. abstract class Info { publicabstract void load(); }

Which class correctly uses the Datainterface and Info class?

A.   public class Employee extendsInfo implements Data { public void load() { /*do something*/ }

}

B.   public class Employeeimplements Info extends Data { public void load() { /*do something*/ }

}

C.   public class Employee extendsInfo implements Data { public void load(){ /*do something*/ }public voidInfo.load(){ /*do something*/ }

}

D.   public class Employeeimplements Info extends Data { public void Data.load(){ /*do something*/}public void load(){ /*do something*/ }

}

E.   public class Employeeimplements Info extends Data { public void load(){ /*do something*/ }publicvoid Info.load(){ /*do something*/ }

}

F.    public class Employee extendsInfo implements Data{public void Data.load() { /*do something*/ }

public void Info.load() { /*do something*/}

}

Answer: A

QUESTION 156 Given:

11. public class Rainbow {

12. public enum MyColor {

13. RED(0xff0000), GREEN(0x00ff00),BLUE(0x0000ff);

14. private final int rgb;

15. MyColor(int rgb) { this.rgb =rgb; }

16. public int getRGB() { returnrgb; }

17. };

18. public static voidmain(String[] args) {

19. // insert code here

20. }

21. }

Which code fragment, inserted at line 19,allows the Rainbow class to compile?

A.   MyColor skyColor = BLUE;

B.   MyColor treeColor =MyColor.GREEN;

C.   if(RED.getRGB()

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    115979博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0877s