0
should we try to minimize declaring instance variables?
is declaring instance variable instead of local variable effects efficiency in java app?
1 Odpowiedź
0
Its based on your use case. If you need to use a field that should be globally accessible then create an instance field. If you need to create a local field that will be used within the scope of a method then use that. Try not to recreate large objects as local variabled. IE instantiating a large object every time you run a method.