Core Java SQL Oracle PHP Examples JSP JDBC MORE

Java Identifier


Name in Java Program Which Can be Used For identification purpose is Called as Identifier.

It Can be class name ,Method name, level name, variable name.

Rules For Defining Java Identifier.

  1. Only Allowed Character Symbols are allows a-z, A-Z, 0-9, $. If We are using other character We will get Compile time error.
  2. total_number - Valid

    total # - Invalid

  3. Identifier Should not start with the digit
  4. Total 123 - Valid

    123 total - Invalid

  5. Java identifier are case sensitive of course java language
  6. int number =10;//Correct

    Int Number =20;//Wrong

    Int NUMBER =30;//Wrong

  7. There Is no length limit for identifiers but it is not Recomonded to take too lengthy identifier.
  8. We cant use Reserved word as identifier.
  9. All Predefined java Classname ,Interface names We can use as identifiers. Even though it is valid but not a programming Pratice because it reduces readability under creates confusion.