多选题
Given:
2. public class Payroll {
3. int salary;
4. int getSalary() {return salary; }
5. void setSalary(int s) {
6. assert(s > 30000);
7. salary = s;
8. } }
Which are true? (Choose all that apply.)
A、
Compilation fails.
B、
The class is well encapsulated as it stands.
C、
Removing line 6 would weaken the class"s degree of cohesion.
D、
Removing line 6 would weaken the class"s degree of encapsulation.
E、
If the salary variable was private, the class would be well encapsulated.
F、
Removing line 6 would make the class"s use of assertions more appropriate.
【正确答案】
E、F
【答案解析】
提交答案
关闭