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 –

  1. First character of variable name must be an alphabet.
  2. 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.
  3. 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.
  4. It should not be keyword.
  5. White space is not allowed.
  6. Variable names can be of any length.