Identifiers are programmer-Designed tokens. They are used for naming classes, methods, variables, objects, labels, packages and Interfaces in a program. Java Identifiers follow the following rules:
Identifiers must be meaningful, short enough to be quickly typed and long to be descriptive and easily read. Java developers have followed some naming conventions.
1. Names of all public methods and instance variables start with a leading lowercase letter.
Example: average(), sum();
2. When more than one words are used in a name, the second and subsequent words are marked with a leading uppercase letters.
Example: dayTemperature
3. All primitive and local variables use only lowercase letters combined with underscores.
Example: length, batch_strength
4. All classes and interfaces start with a leading uppercase letter and each subsequent word with a leading uppercase letter.
Example: Student, HelloJava
5. Variables that represent constant values use all uppercase letters and underscores between words.
Example: TOTAL, F_MAX
Along with these java uses the some more naming convention rule. Click Here to know
- They can have alphabets, digits, and the underscore and dollar sing character.
- They must not begin with a digit.
- Uppercase and lowercase letters are distinct.
- They can be of any length.
Identifiers must be meaningful, short enough to be quickly typed and long to be descriptive and easily read. Java developers have followed some naming conventions.
1. Names of all public methods and instance variables start with a leading lowercase letter.
Example: average(), sum();
2. When more than one words are used in a name, the second and subsequent words are marked with a leading uppercase letters.
Example: dayTemperature
3. All primitive and local variables use only lowercase letters combined with underscores.
Example: length, batch_strength
4. All classes and interfaces start with a leading uppercase letter and each subsequent word with a leading uppercase letter.
Example: Student, HelloJava
5. Variables that represent constant values use all uppercase letters and underscores between words.
Example: TOTAL, F_MAX
Along with these java uses the some more naming convention rule. Click Here to know
0 comments :
Post a Comment
Note: only a member of this blog may post a comment.