CORE JAVA

ProwessApps Learning Portal

Java Identifiers


  • Identifiers are programmer defined tokens.

  • They are used fro naming classes, methods, variables, packages, and interfaces in a program.

Rules for a Legal Identifier :
  1. They can be a set of alphabet, digits, underscore ( _ ) and dollar ( $ ) character.

  2. They must not begin with digit .

  3. Since Java is case sensitive language, Uppercase and Lowercase letters are distinct.

  4. They can be of any length.

  5. They must not be a keyword.


Example of legal identifier :
     arena , s_count
     marks40
     class_one
Example of illegal identifier :
     1sst
     2nd number
     oh!god



advertisement