Variable: – A variable is an identifier that denotes a storage location used to store data value. Unlike constants that remain unchanged during the execution of program, a variable may take different values at different times during the execution of program. A variable name can be chosen by the program in a meaningful way so as to reflect. What it represents in the program. Variable name can be declaring by the programmer in the following condition –
- First character of variable name must be an alphabet.
- Because java is a case sensitive, upper and lower-case letters are treated as distinct. This means that the variable name Total is not the same as total or TOTAL.
- A sequence of letters followed by a sequence of digit can be used as a variable name. only underscore sign can be used as a special character with variable name.
- It should not be keyword.
- White space is not allowed.
- Variable names can be of any length.