Naming conventions must be followed while developing software in java for good maintenance and readability of code. Java uses CamelCase as a practice for writing names of methods, variables, classes, packages and constants.
Camel case in Java Programming: It consists of mix words such that each word or abbreviation begins with a capital letter or first word with a lowercase letter, rest all with capital.
Class names and Interface names should be noun in mixed case with the first letter of each internal word capitalized. Use whole words and must avoid acronyms and abbreviations.Examples:
interface Area interface FindArea class Area class FindArea
Methods should be verbs, in mixed case with the first letter lowercase and with the first letter of each internal word capitalized.Examples:
void changeGear(int newValue); void change(); void speedUp(int increment); void applyOnBrakes(int decrement);
One-character variable names should be avoided except for temporary variables. Variable names should be short yet meaningful and in small letters.Examples:
int speed = 0; double areaOfCircle=55.3; int gear = 1;
Should be all uppercase with words separated by underscores (â€œ_â€). There are various constants used in predefined classes like Character, Float, Long, String etc.Examples:
static final int WIDTH = 4;
The prefix of a unique package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, like com, edu, gov, mil, net, org. Subsequent components of the package name vary according to an organizationâ€™s own internal naming conventions.Examples:
com.sun.eng com.help4code.project java.lang java.util