A name in the program is an identifier,it may be class name or method name or variable name or label name.

public class IdentifierDemo{
          public static void main(String[] args){
             int age;   

In the above program IdentifierDemo,main,String,args and age are the identifiers.

Rules for defining Identifiers

  1. An identifier consists of a sequence of characters, where each character is a letter from a-z or A-Z or a digit form 0-9 or currency symbol $ or connecting punctuation _(underscore), if we are using any other symbol we will get Compile time error saying “IllegalCharacter”.
  2. The first character in a identifier should not be a digit.
    total123 is a valid identifier
    891total is not a valid identifier
  3. There is no length limit for java identifiers,but it is not recommended to take more than 15 character length.
  4. The java identifiers are case sensitive

    class Test{
     int number=10;
     int NUMBER=20;
     int NuMbEr=30 

    All the above identifiers are valid.

  5. keywords/reserved words are not allowed to used as a identifiers
  6. We can use all predefined java class names and interface names as identifiers


class FundaDemo{
 public static void main(String[] args){
  int String = 10;

Output: 10
In the above program String is class.