失效链接处理 |
OCJP(1z0-808)试题答案详解 PDF 下载
本站整理下载:
相关截图:
主要内容:
QUESTION 1
Given:
What is the result?
A. 200.0 : 100.0
B. 400.0 : 200.0
C. 400.0 : 100.0
D. Compilation fails.
Correct Answer: C
分析:
Java的参数传递只有值传递,即传递的是实参的一个拷贝。题中t.updatePrice(prt, newPrice)中prt是引用数据类型,值传递的是指向对象的地址,所以实参和形参指向的是同一个
对象。newPrice是基本数据类型,值传递给形参的拷贝和实参没有关系,所以值不会变化。
QUESTION 2
Given the following segment of code :
Which two statements, if either were true, would make the code compile? (Choose two.)
A. Vehicleis aninterfacethatis implementedbytheMotorcycleclass.
B. VehicleandMotorcyclebothimplementtheTransportationinterface
C. Vehicleis a superclass of Motorcycle.
D. Motorcycleis a superclass of Vehicle.
E. VehicleandMotorcyclebothextendtheTransportationsuperclass.
F. Motorcycleis aninterfacethatimplements theVehicleclass.
Correct Answer: AC
分析:
哪两个语句(如果正确)可以使代码通过编译?
A.Vehicle 是一个被 Motorcycle 类实现的接口。
B.Vehicle 和 Motorcycle 都实现了 Transportation 接口。
C.Vehicle 是 Motorcycle 的父类。
D.Motorcycle 是 Vehicle 的父类。
E.Vehicle 和 Motorcycle 都继承了 Transportation 类。
F.Motorcycle 是一个实现了 Vehicle 类的接口。
Vehicle:车辆;Motorcycle:摩托车;Transportation:运输工具;
如果Vehicle是接口,Motorcycle必须是其实现类,如果Vehicle是一个类,Motorcycle必须是其子类,所以AC选项正确。
QUESTION 3
Given the code fragment:
What is the result?
A. May 04, 2014T00:00:00.000
|