Encapsulation

16.How does abstraction contribute to code maintainability?
  • A. By exposing all class details to other classes
  • B. By making it easier to modify the internal logic without affecting external code
  • C. By forcing all methods to be static
  • D. By eliminating the need for constructors

By making it easier to modify the internal logic without affecting external code

By making it easier to modify the internal logic without affecting external code

17.How does abstraction differ from encapsulation?
  • A. Abstraction focuses on hiding implementation, while encapsulation protects data
  • B. Encapsulation involves abstract methods only
  • C. Encapsulation and abstraction are the same concept
  • D. Abstraction forces all classes to be final

Abstraction focuses on hiding implementation, while encapsulation protects data

Abstraction focuses on hiding implementation, while encapsulation protects data