The location at which a variable is declared defines its scope, which is the area within a program in which that variable can be referenced. By being declared at the class level (not within a method), these variables and constants can be referenced in any method of the class.
The scope of a variable, which determines where it can be referenced, depends on where it is declared.
the scope of a variable or constant is the part of a program in which a valid reference to that variable can be made.