文档介绍:1. Given the following, 1. public class Barbell { 2. public int getWeight() { 3. return weight; 4.} 5. public void setWeight(int w){ 6. weight = w; 7.} 8. public int weight; 9.} which is true about the class described above? A. Class Barbell is tightly encapsulated. 这个类是一个很好的封装类 B. Line 2 is in conflict with encapsulation. C. Line 5 is in conflict with encapsulation. D. Line 8 is in conflict with encapsulation. E. Lines 5 and 8 are in conflict with encapsulation. F. Lines 2, 5, and 8 are in conflict with encapsulation. 2. Given the following, 1. public class B extends A{ 2. private int bar; 3. public void setBar(int b){ 4. bar = b; 5.} 6.} 7. class A{ 8. public int foo; 9.} which is true about the classes described above? A和B 都不是很好的封装类 A. Class A is tightly encapsulated. B. Class B is tightly encapsulated. C. Classes A and B are both tightly encapsulated. D. Neither class A nor class B is tightly encapsulated. 3. Which is true? A. Tightly encapsulated classes are typically easier to reuse ( 重用). B. Tightly encapsulated classes typically use inheritance more than unencapsulated classes. C. Methods in tightly encapsulated classes cannot be overridden. D. Methods in tightly encapsulated classes cannot be overloaded. E. Tightly encapsulated classes typically do not use HAS-A relationships. HS 是一种继承关系 HAS 关联的关系 4. Which two are not benefits of encapsulation? (Choose two.) A. Clarity