1. Basic Naming convention standards:Â
To describe variable/constant/method/class/interface etc use full descriptor. E.g.: rollNumber, firstName, lastName, getTotalMarks().
2. Naming variable:
Use first word in small letters and all remaining words will be capitalized. E.g. – rollNumber, firstName.
3. Naming Constants:
Use all letters in upper case. E.g. – MAX_MARKS.
4. Naming methods:
a). Naming member methods :Â
Use first word in small letters and all remaining words will be capitalized. E.g. – getTotalMarks().
b). Naming accessor methods:
for getters – use get as prefix to property (for non Boolean properties). e.g. – getRollNumber().
for setters – use set as prefix to property. e.g. – setRollNumber().
use is as prefix to property(for Boolean properties). e.g. – isNewStudent().
5. Naming class/interface:
Use capitalized words for class/interface name. E.g.- HelloWorld.
6. Comment:Â
For clarity of the code add comments.
Next Topic: Some important definitions for java programs.
Previous Topic: Difference between JVM, JRE and JDK.
Related Topics:
Programming language overview. |
Overview of Java. |
Java features |
JVM (java virtual machine) architecture details. |
Difference between JVM, JRE and JDK. |
Java Coding Guidelines. |