oracle认证的java考试(4)

所需积分/C币:10 2012-10-08 17:33:26 226KB PDF
2
收藏 收藏
举报

oracle认证的java考试(4)
arena 达内科技 1. It must be possible to create instances of alpha and Beta from outside the packages in which they are defined 2. When an object of type Alpha (or any potential subclass of Alpha) has been created, the instance variable alpha may never be changed 3. The value of the instance variable alpha must always be "A" for objects of type Alpha code public s alpha i Modifiers private String alpha, private public Alpha this(a): 1 protected protected Alpha( string a)alpha=a, J publIc package beta public class Beta extends alpha. Alpha i public Beta(String a)(super(a) I 达内科技(中国)有限公司版权所有 arena 达内科技 QUESTION 22 Given: 1. package geometry 2. public class Hypotenuse i 3. public Inner Triangle it new Inner Triangle 0 4. class InnerTriangle 5. public int base 6. publlc Int height 7 8. Which statement is true about the class of an object that can reference the variable base? A. It can be any class b. No class has access to base C. The class must belong to the geometry package D. The class must be a subclass of the class Hypotenuse 必 考点: 缺省修饰符修饰的类中的成员变量,访问范围 本题详解: 题十:以卜陈述中哪个类的对象可以用变量base。A任何类都可以访问; B没有类可以访间base; C geometry中的类都可以访间 base D.必须是 Hypotenuse的子类才可以访间base 因为类 nner Triangle是用缺省修饰符修饰的,所以只能在木包 geometry 甲面使用。故C选项止确 Answer: C 达内科技(中国)有限公司版权所有 arena 达内科技 QUESTION 23 Given the exhibit package certkiller class Target public String name = hello What can directly access and change the value of the variable name? A. any class B. only the Target class C. any class in the Certkiller package D. any class that extends target 考点: 缺省修饰符修饰的类中的成员变量,访问范围。 本题详解 题干:那个陈述中的类可以修改变量nme的值。A仁何类都可以:B仅有 Target这个类;C在 Certkiller包中的任何类:D所你继承 Target的子类都可以访 因为类 Target缺省修饰符修饰,所以具可以在 certkillert包中使用。故选 项正确。 Answer. C 达内科技(中国)有限公司版权所有 arena 达内科技 QUESTION 24 DRAG DROP Replace two of the Modifiers that appear in the Single class to make code compile Note: Three modifiers will not be used and four modifiers in the code wil remain unchanged code Modifiers public class Single i final rivate static Single instance I protected public static Single getinstance(( vate if(instance == null)instance create return instance: abstract private Single(1 static protected Single( create return new Single; y class single Sub extends single i 考点: Java访问控制符 本题详解: 题干:只修改两处使类 Single能成功编译。 (1)因为类 Singlesub继承了了Smge,会默认调用 Single的无参构造 即 Single的无参构造必须用 public或是 protected来修饰,不可以是私有的。 2)在静态方法 getInstance中用到了方法 create(),而静态方法是不可以 调用非静态方法的如果想编泽成功,必须让 create()也用sat.修饰 Answer code public class single i private static Single instance public static Single getInstance()( if (instance == null)instance =create return instance Protected Single t static Single( create return new Single class Single Sub extends Single i 达内科技(中国)有限公司版权所有

...展开详情
立即下载 低至0.43元/次 身份认证VIP会员低至7折
一个资源只可评论一次,评论内容不能少于5个字
momran 题目分析的比较仔细
2014-05-09
回复
huluwii88 题目分析的比较仔细
2012-10-28
回复
您会向同学/朋友/同事推荐我们的CSDN下载吗?
谢谢参与!您的真实评价是我们改进的动力~
  • 分享宗师

    成功上传21个资源即可获取
关注 私信
上传资源赚积分or赚钱
最新推荐