A name in java program is called identifier. It could be class name, method name, variable name , e.t.c.
Rules to define java identifiers:
- a-z,A-Z,0-9,_, $ are the only allowed characters in java identifiers. If we are using any other character we will get compile time error.
- Identifiers are not allowed to starts with digit.
- Java identifiers are case sensitive.
- There is no length limit for java identifiers but it is not recommended to take more than 15 lengths.
- We can’t use reserved words as identifiers.
- All predefined java class names and interface names we use as identifiers.