21.) Which access modifier allows a class member to be accessible within the same package and by subclasses outside the package?
A) private
B) default
C) protected
D) public
22.) In Java, what is the role of getters and setters in encapsulation?
A) Getters and setters are used to expose all internal attributes of a class.
B) Getters and setters allow direct access to attributes without restrictions.
C) Getters and setters provide controlled access to attributes while enforcing validation and encapsulation.
D) Getters and setters are used for constructor initialization.
23.) How does encapsulation contribute to code reusability in Java?
A) By allowing direct modification of attributes
B) By preventing access to class members
C) By promoting the inheritance of private methods
D) By providing controlled methods for attribute access and modification