Java OCA OCP Practice Question 421

Question

Given:

1) ClassA has a ClassD
2) Methods in ClassA use public methods in ClassB
3) Methods in ClassC use public methods in ClassA
4) Methods in ClassA use public variables in ClassB

Which is most likely true?

Choose only one.

A.  ClassD has low cohesion.
B.  ClassA has weak encapsulation.
C.  ClassB has weak encapsulation.
D.  ClassB has strong encapsulation.
E.  ClassC is tightly coupled to ClassA.


C is correct.

Note

Generally speaking, public variables are a sign of weak encapsulation.

A, B, D, and E are incorrect because based on the information given, none of these statements can be supported.




PreviousNext

Related