how to make a new variable in java code example
Example 1: java variable declaration
java decleration
float simpleInterest; //Declaring float variable
Example 2: 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);
}
}