Variables |
---|
The variable is the basic unit of storage in a Java program. A variable is defined by the combination of an identifier, a type, and an optional initializer. In addition, all variables have a scope, which defines their visibility, and a lifetime. These elements are examined next. |
Declaring a Variable |
---|
In Java, all variables must be declared before they can be used. The basic form of a variable declaration is shown here: |
type identifier [ = value][, identifier [= value] ...] ; |
class var { public static void main(String args[]) { int a=1; float b=1.0; double c=1.0; System.out.println("Int,float,double"+a,b,c); }