declaration of variables code example
Example 1: what is declaration of variable
declaration of variable just means defining that a variable of given data type is needed and hence compiler creates a memory block for such a variable based on its data type.
In Java, int n;
Example 2: what is declaration of variable
A declaration of a variable is where a program says that it needs a variable. For our small programs, place declaration statements between the two braces of the main method. The declaration gives a name and a data type for the variable. ... A variable cannot be used in a program unless it has been declared.