Java SE 8 Programmer I — Question 133
Which two features can be implemented in a Java application by encapsulating the entity classes used? (Choose two.)
Answer options
- A. data validation
- B. compile time polymorphism
- C. data hiding
- D. data abstraction
- E. data memory optimization
Correct answer: C, D
Explanation
The correct answers, C (data hiding) and D (data abstraction), are fundamental principles of encapsulation in object-oriented programming. Data hiding restricts access to the internal state of an object, while data abstraction simplifies complex reality by modeling classes based on the essential characteristics. The other options do not directly relate to encapsulation in the same way.