Keywords & Variables

Keywords –

  • Keywords are reserved words or predefined words that you cannot use as a variable or object name. In addition, they have special meaning for the compiler.
  • True, false, and null are not reserved words; however, you cannot use it as identifiers, because it is literals of built-in types. 
  • Some of the examples include abstract, boolean, break, extend, public, return, etc.

Identifier –

  • An identifier is a string of alphanumeric characters (a-z , A-Z , 0-9) (i.e. letters & digits) and underscore( _ ) symbol.
  • It is a token (in other words, a symbol) that name language entities; for instance, constants, variables, structures, functions, etc.
  • Identifier names must be unique and must not contain white spaces.
  • The first character should be an alphabet or an underscore.
  • You cannot use a keyword as identifiers.
  • Identifiers are case-sensitive.

Variables –

  •  A variable is a container that holds the value while the program it executes. The program can change the value stored in a variable during program execution.
  • Every variable has a specific type, which determines the following –
    • Size of its memory
    • The range of values that it can store
    • The set of operations that it can apply to the variable.
  • Examples include (with & without assignment) –
    • int total;
    • int total = 50;