English

What is the scope of a local variable in Java?

Advertisements

Question

What is the scope of a local variable in Java?

Short Answer
Advertisements

Solution

The scope of a local variable in Java is limited to the method, constructor, or block in which it is declared. It can be accessed and used only within that particular region of the program and cannot be accessed outside its scope.

shaalaa.com
  Is there an error in this question or solution?
Chapter 6: Variables and Expressions - SHORT ASSIGNMENTS [Page 136]

APPEARS IN

Dheeraj Mehrotra Computer Science [English] Class 12
Chapter 6 Variables and Expressions
SHORT ASSIGNMENTS | Q 31. | Page 136
Advertisements
Share
Notifications



      Forgot password?
Use app×