I have a method where it takes in an object as an input
void doSomething(MyObject myObj) {
///
}
In this method, it calls myObj.getValue()
several times for various reasons
Is it better to just store as int objValue = myObj.getValue()
and use objValue
throughout the method, instead keep calling myObj.getValue()
why? why not?