In this program we will create a variable and assign it value.
2Variable.java
2Variable.java
class Variable{
public static void main(String args[]){
int num; // Variable Declaration
num=10; // Variable Initialization
System.out.println("\n\n This is num: "+num);
num=num*2;
System.out.println("\n\n The value of num*2 is "+num);
}
}
public static void main(String args[]){
int num; // Variable Declaration
num=10; // Variable Initialization
System.out.println("\n\n This is num: "+num);
num=num*2;
System.out.println("\n\n The value of num*2 is "+num);
}
}
Output: