DEVFYI - Developer Resource - FYI

What is scope

J2SE Interview Questions and Answers


(Continued from previous question...)

194. What is scope

A characteristic of an identifier that determines where the identifier can be used. Most identifiers in the Java programming environment have either class or local scope. Instance and class variables and methods have class scope; they can be used outside the class and its subclasses only by prefixing them with an instance of the class or (for class variables and methods) with the class name. All other variables are declared within methods and have local scope; they can be used only within the enclosing block.

(Continued on next question...)

Other Interview Questions