The convention or standard for naming a variable ,class etc. are used in java programming to make a java program more readable and understandable for human being.
It is advised to use naming convention in a java program but it is not forced to use it.They can also be used as to give a meaningful information about the function of the identifier(variables, methods, classes, packages and interfaces in a program).
The list of naming convention of java are:
- constants name It should be in uppercase letter. e.g. MAX_PRIORITY etc.
- class name It should start with uppercase letter and be a noun like String, Color, Button, Thread etc.
- interface name It should start with uppercase letter and be an adjective like Remote, MotionListener etc.
- method name It should start with lowercase letter and be a verb like actionComplete(), main(), print(), println() etc.
- variable name It should follow the camelCase means start with lowercase letter like lastName, orderNumber etc.
- package name It should be in lowercase letter e.g. java, lang, sql, util etc.