The easy way: If the variable must be shared by more than one method, use instance variable, otherwise use local variable. However, the good practice is to use as more local variables as possible.