Naming Convention In Java

Naming Convention In Java

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:

  1. constants name It should be in uppercase letter. e.g. MAX_PRIORITY etc.
  2. class name It should start with uppercase letter and be a noun like String, Color, Button, Thread etc.
  3. interface name It should start with uppercase letter and be an adjective like Remote, MotionListener etc.
  4. method name It should start with lowercase letter and be a verb like actionComplete(), main(), print(), println() etc.
  5. variable name It should follow the camelCase means start with lowercase letter like lastName, orderNumber etc.
  6. package name It should be in lowercase letter e.g. java, lang, sql, util etc.