Declaration of variable: – In java, variables are the names of storage location. After designing suitable variable name, we must declare them to the compiler. declaration does three things. (1) It tells the compiler what the variable name (2) It specifies what type of data the variable will hold. (3) The place of declaration decides the scope of variables.
A variable must be declare before it is used in the program. A variable can be use the storage a value of any data type. That is, the name has nothing to do with the type. Java allows any property formed variable to have any declare data type. Syntax of the variable declaration is –
<Data Type> <Variable1, Variable2, _ _ _ >;