What are local variables?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What are local variables?
Rating:
Variables declared within blocks (i.e., inside braces) are known as local variables. They are so called because they are not available for use outside the block where they are declared. These variables are temporary variables, which are visible to the program only within the scope of the block. When the program control leaves a block, all the variables in the block cease to exist.
For the same reason, variables declared inside a method are also known as local variables. The scope defined by a method begins with the block that follows the method declaration. If the method has parameters, they too are included within the scope of the method.
Rating:
Was this information helpful?
Other articles
- What is encapsulation?
- What is a multidimensional array?
- What is final?
- What is the FileOutputStream class?
- What is array initializer?