0
Unnecessary method change()?
Just to be clear, instead of calling the method change() which changes the value to ten, can't we just say p.setAge(10)?
1 Answer
+ 1
sure you can. but it's just a sample to teach you how to reuse functions (methods). the pro of modular programming is to be able to reuse repetitive functions without having to implement over and over.