Variables

VARIABLES

  • Variables are used to store the values of a specific data type.
  • Variable name can be started with Letters or $ and _ symbols.
  • Variable name Start with Lowercase Alphabets.
  • Variable name can be succeeded with numbers.
  • Variable name cannot be started with numbers.
  • No other Symbols are used in variable name except $ and _ .

Syntax:

<datatype> <variablename> ;


Correct way to declare a Variable 

  • int height;
  • String name;
  • float num1;
  • int _number;
  • boolean $id;
Incorrect way to declare a Variable
  • height int;
  • int %num;
  • String 1name;

Comments

Popular posts from this blog

Constructors in java