Which two are benefits of fully encapsulating a class?
-
Implementation details of the class are hidden.
-
Access modifiers can be omitted on class data members.
-
Internal operation of the class can be modified without impacting clients of that class.
-
Code that uses the encapsulation class can access data members directly.
-
Performance of class methods is improved.
Encapsulation provides two key benefits: (A) True - hiding implementation details behind public methods. (C) True - internal changes don't break client code as long as the public interface remains stable. Option B is false - you need access modifiers (private/protected) to encapsulate. Option D is false - clients access via methods, not directly. Option E is false - encapsulation may add slight overhead from getter/setter calls.
Encapsulation bundles data with the methods that operate on it and hides internal state behind an interface. The two real benefits here are: (1) implementation details are hidden from callers, and (2) because callers only depend on the public interface, the internal implementation can be changed freely without breaking client code. 'Omitting access modifiers' is the opposite of encapsulation (it would expose fields). 'Code accessing data members directly' also violates encapsulation rather than benefiting from it. 'Improved performance' isn't a property of encapsulation — it's a design/maintainability concern, not a speed optimization.