Identifiers in Java

Notes:

Identifiers in Java Programming Language:

Identifier:
Identifier is a sequence of characters; which help us to identify specific part of a program.
Identifiers are names given to the program elements by the programmers. Hence they are also called programmer defined names or user defined names.

Ex:
name of a variable
name of a constant
name of an array
name of a method
name of a class
name of an object
name of an interface
name of a package
etc.

Naming conventions: are the rules or guidelines for writing identifiers
1. Identifiers should be meaningful and descriptive.
2. Keywords should not be used as identifiers.
3. First character of an identifier must be an alphabet.
4. First character should not be a digit or a number.
5. All succeeding characters can be alphabets, digits, underscores , or dollars.
6. Except an underscore and dollar no other special characters are allowed, not even space.
7. More than one successive underscores or dollars should not be written
8. Identifiers should be unique in a scope.
9. Identifiers are case sensitive.

Valid: Identifiers
Variable names: ps, ph, studentName, studentname, playerScore, player9, priceIn$, playerHealth, etc.
Method Names: setWidth(), setHeight(), etc.
Constant Names: SCREEN_WIDTH, SCREEN_HEIGHT, etc.
Class, Interface names: Student, MathLibrary etc.
Package names: math, utilities etc.

Invalid: Identifiers
9thplayer, flag_ _size, price$$, player health, continue, while, break, etc.