java programming variables code example
Example: Variables in java
// local variable in java example
public class LocalVariableExample
{
public void employeeDetails()
{
// local variable empAge and name
int empAge = 22;
String name = "Sachin";
}
public static void main(String[] args)
{
LocalVariableExample obj = new LocalVariableExample();
// name and empAge cannot
// be resolved to a variable
System.out.println("Employee name is : " + name + ", and age : " + empAge);
}
}