Pass in the snooze interval when you call the method. Since their lifetimes span the length of the method in which they are declared, local variables compare to a notepad that appears every time you receive a telephone call, but disappears once you hang up the phone. That setup can be useful for jotting down notes, but you often want something a little more permanent. Enter member variables . I will consider instance variables now, and return to static variables in a later article.
Developers implement instance variables to contain data useful to a class.
An instance variable differs from a local variable in the nature of its scope and its lifetime. The entire class makes up the scope of an instance variable, not the method in which it was declared. In other words, developers can access instance variables anywhere in the class. Instances are the actual objects that you create from the blueprint you design in the class definition. You declare instance variables in the class definition, affecting each instance you create from the blueprint.