Assume a scenario where we can use a local variable vs access an instance variable what should I chose ?
eg: inside foo.java
int x = bar.getX();
int y = x * 5;
Advantage is that we dont have performance impact of accessing object variable over and over.
or inside foo.java
int y = bar.getX() * 5;
Advantage of using the second method, is we dont need to create and maintain another variable.