Local Variable
Author: Ravi Poswal
iii. Local Variable
A variable declared within a method, constructor, or a specific block of code such as a loop or a if statement is called a local variable. The scope of a local variable is limited strictly to the block in which it is declared, meaning it cannot be accessed or used outside that block.
Code Example
class A
{
public static void main(String arg[])
{ int a=15;
System.out.println("hello Ranrev "+a);
} }
RANREV INFOTECH