Which two statements are true? (Choose two.) 
 
A. An encapsulation(封装), public class promotes re-use. 
B. Classes that share the same interface are always tightly encapsulated. 
C. An encapsulated class allows subclasses to overload methods, but does NOT allow 
overriding methods. 
D. An encapsulated class allows programmer to change an implementation without 
affecting outside code.
Answer: ( A, D)
参考大纲:面向对象
英文看提不是很明白,还有选项也不是很理解。
有请高手讲解,谢谢!

解决方案 »

  1.   

    声明:我不是高手
    这道题目主要是考察OO的知识
    A.封装有利于代码复用(OO的特点之一)【Y】
    B.接口是提供给其他类扩展的,如果把接口的内容都封装起来,对于其他类不可见如何扩展?【N】
    C.一个封装的类允许子类重载方法【Y】,不允许子类重写方法【N】,多态的实现:继承、重载、重写
    D.类的封装有一个特点就是隐藏了内部的具体实现细节,当实现细节改变时,是不会影响外部的调用的【Y】如果需要SCJP的资料可以Q我,QQ:584783469