Need a Website Or Web Application Or Any Help.Contact Us: +91 9437911966 (Whatsapp) Note: Paid Service
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.
- Only Allowed Character Symbols are allows a-z, A-Z, 0-9, $.
If We are using other character We will get Compile time error.
total_number - Valid
total # - Invalid
- Identifier Should not start with the digit
Total 123 - Valid
123 total - Invalid
- Java identifier are case sensitive of course java language
int number =10;//Correct
Int Number =20;//Wrong
Int NUMBER =30;//Wrong
- There Is no length limit for identifiers but it is not Recomonded to take too lengthy identifier.
- We cant use Reserved word as identifier.
- 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.