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

QUESTION 150

Click the Exhibit button. Given: ClassA a = new ClassA(); a.methodA(); What is the result?

A. Compilation fails.
B. ClassC is displayed.
C. The code runs with no output.
D. An exception is thrown at runtime.
Answer: D

问题出在第24行,classC还没有new一个,就直接用函数getValue(),NullPointerException会被抛出

public ClassC classC;该行代码没有new出来ClassC,空指针异常;

QUESTION 151 Given:

11. static void test() throwsRuntimeException {

12. try {

13. System.out.print("test");

14. throw new RuntimeException();

15. }

16. catch (Exception ex) { System.out.print("exception"); }

17. }

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

19. try { test(); }

20. catch (RuntimeException ex) {System.out.print("runtime "); }

21. System.out.print("end");

22. }

What is the result?

A.   test end

B.   Compilation fails.

C.   test runtime end

D.   test exception end

E.   A Throwable is thrown by mainat runtime.

Answer: D

QUESTION 152 Given:

1. public class Plant {

2. private String name;

3. public Plant(String name) {this.name = name; }

4. public String getName() { returnname; }

5. }

1. public class Tree extends Plant{

2. public void growFruit() { }

3. public void dropLeaves() { }

4. }

Which statement is true?

A.   The code will compile withoutchanges.

B.   The code will compile if publicTree() { Plant(); } is added to the Tree class.

C.   The code will compile if publicPlant() { Tree(); } is added to the Plant class.

D.   The code willcompile if public Plant() { this("fern"); } is added to the Plantclass.

E.   The code will compile if publicPlant() { Plant("fern"); } is added to the Plant class.

Answer: D

Section: (none)

Plant需要一个无参默认构造函数,因为子类带一个参数的构造函数

QUESTION 153

Given:

10. class Line {

11. public static class Point {}

12. }

13.

14. class Triangle {

15. // insert code here

16. }

Which code, inserted at line 15, createsan instance of the Point class defined in Line?

A.   Point p = new Point();

B.   Line.Point p = newLine.Point();

C.   The Point class cannot beinstatiated at line 15.

D.   Line l = new Line() ; l.Point p= new l.Point();

Answer: B

QUESTION 154 Given:

10. class Nav{

11. public enum Direction { NORTH,SOUTH, EAST, WEST }

12. }

13. public class Sprite{

14. // insert code here

15. }

Which code, inserted at line 14, allowsthe Sprite class to compile?

A.   Direction d = NORTH;

B.   Nav.Direction d = NORTH;

C.   Direction d = Direction.NORTH;

D.   Nav.Direction d = Nav.Direction.NORTH;

Answer: D

Section: (none)

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

OCJP 考试题之七相关推荐

  1. OCJP 考试题之九

    OCJP视频课堂,具体讲解:https://edu.csdn.net/course/detail/7811 QUESTION 177 Given: 1.     class TestException ...

  2. OCJP 考试题之八

    OCJP视频课堂,具体讲解:https://edu.csdn.net/course/detail/7811 QUESTION 139 Giventhe following directory stru ...

  3. ORACLE认证考试之ocjp 考试题之四

    OCJP视频课堂,具体讲解:https://edu.csdn.net/course/detail/7811 QUESTION 73 Given: 10: public class Hello { 11 ...

  4. matlab画图(plot)命令

    原创 xiaotao_1 最后发布于2018-01-18 19:55:25 阅读数 56917 收藏 发布于2018-01-18 19:55:25 分类专栏: matlab 版权声明:本文为博主原创文 ...

  5. OCJP Oracle认证Java程序员考试题库分享

    1z0-808 Java SE 8 Programmer I 题库 pdf文档一共197页. 点击链接获取

  6. 不看OCJP考题你永远不知道自己的JAVA基础有多差(一)

    虽然在国内IT业内各种考证被许多牛人不齿,用人单位也往往不做硬性要求,但是自从SUN公司被ORACLE收购之后,JAVA的认证考试的难度是有目共睹的,目前传出的消息OCJP的一次通过率只有10%左右, ...

  7. 【经典】javascript ES5原生实现考试题答案全排列组合数组结果获取

    //考试题答案全排列组合function getAllArrange(arr, index, group) {index || (index = 0), group || (group = []);v ...

  8. c语言字符串机考题,2016全国计算机二级《C语言》机考试题及答案

    2016全国计算机二级<C语言>机考试题及答案 一.程序填空题(共18分) 下列给定程序中,函数fun的功能是:求ss所指字符串数组中长度最短的字符串所在的行下标,作为函数值返回,并把其串 ...

  9. 计算机专业期末考试是编程序,计算机专业技能期末考试题

    计算机专业技能期末考试题 一.VFP数据库(共50分) 1.创建数据库 (1)以考号姓名(1801张三)创建考生文件夹及子文件夹(学号+VFP),并设置为默认路径.(4分) (2)创建zg.pjx项目 ...

最新文章

  1. Xenapp安装后手动更改XML Service端口,以便使用不同于 IIS 的端口
  2. 用java编写五子棋游戏_java编写一个五子棋游戏,拜托了
  3. java additem 错,Java错误:IllegalArgumentException:向容器添加窗口
  4. css 对话框阴影,科技常识:css实现不规则图形的阴影(如对话框)
  5. 网络IO之阻塞、非阻塞、同步、异步总结
  6. Android Service: 启动service, 停止service
  7. (转)趋势因子:利用投资期内所有信息的获利方法
  8. WebSocket之GoEasy框架
  9. ps考证分数是用电脑改的吗
  10. android福州经纬度,android....中国各城市的经纬度,
  11. 业务流程图(TFD)实例
  12. 2021.07.29 Oracle学习笔记 2
  13. 【数据库学习】17 视图
  14. unity 模型销毁_Unity中销毁游戏对象的方式
  15. 大数据薪水大概多少_大数据就业岗位有哪些?薪资多少?
  16. android白色暗色主题,使用Kotlin开发Android应用(12) - Dark theme 暗色主题
  17. 万能解压器安卓版_全能压缩app下载 全能压缩(手机解压软件) for Android v11.5 安卓版 下载-脚本之家...
  18. win10操作系统如何把用户名改成英文的
  19. 首场百度大脑开放日来袭 | 全新开放24项AI技术
  20. 如何更改windows2003最大连接数

热门文章

  1. 南京信息工程大学第十届程序设计大赛试题
  2. Android 悬浮窗基本使用
  3. python实用案例合集
  4. 对偶理论说明(深入理解)
  5. 计算机技能培训 d,基于PC的医务人员CPR-D技能培训系统研发
  6. 什么?你也被问到JVM了
  7. proteus原理图转化为pcb
  8. 快速理解 WAL 机制,架构师必备技能!「建议收藏!!」
  9. java 房贷计算器代码_用JAVA编程一个房贷计算器
  10. c++中关于ceil向上取整和floor向下取整,‘/‘除法对整型的处理(详解)