Task 4 of 7 · 0 solved · 7 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

4.4 Encapsulation — getter and setter

Total: 0 / 4 pts
Practice mode — check each part and get hints as you go.
Task

The field balance is private. Write both accessors: getBalance() returning the balance, and setBalance(int b) storing a new one.

The program prints 100.

Your solution