Exam 15 - 16 03 Flashcards

1
Q
  1. public class ModuloCounter {
  2. private int count;
  3. private int modulo;
    4.
  4. public ModuloCounter() { count = 0; modulo = 10; }
    6.
  5. public int getCount() { return count; }
    8.
  6. public void setCount(int val) { count = val; }

b) Explain how the principle of encapsulation has been achieved in
the implementation of this class, and state a benefit of this.

A

Benefits: Encapsulation promotes maintenance
Code changes can be made independently
Increases usability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly