Question: We wrote the class to have public methods called size (to read the number of elements of the list) and get (to access the element
We wrote the class to have public methods called size (to read the number of elements of the list) and get (to access the element value at a specific index). Why is this approach better than declaring the fields (such as size ) public?
Step by Step Solution
3.44 Rating (160 Votes )
There are 3 Steps involved in it
Having accessor methods such as size is better than makin... View full answer
Get step-by-step solutions from verified subject matter experts
