Monday, 12 March 2018

Java Naming Convention

Java naming convention is a simple rule to follow as a developer to decide what to name your identifiers such as class, package, variable, constant, method etc.

Here are rules to follow in Java regarding Naming Convention

Class name: It should start with an uppercase letter and be a noun e.g. Name, String, System, Thread etc.
Interface name: It should start with an uppercase letter and be an adjective e.g. Runnable, Remote, ActionListener etc.
Method name : It should start with lowercase letter and be a verb e.g. actionExecute(), run(), print(), println() etc.
Variable name: It should start with lowercase letter e.g. lastName, messageNumber etc.
Package name: It should be in lowercase letter e.g. impl, lang, sql, util etc.
Constants name: It should be in the uppercase letter. e.g. GREEN, YELLOW, MIN_PRIORITY etc.


Interface  Furnitures
Class Chair implements Furnitures
void changeName(Strung newValue);
void employeeNo(int value);

Java strictly follows the camelcase syntax for naming the class, interface, method and variable.
Camelcase syntax: If name is combined with two words, second word will start with uppercase letter always e.g. actionExecute(), lastName, ActionEvent, ActionListener etc.

1 comment :

  1. Hello! To help you in this matter, I would like to recommend a resource, maybe is better to say the team, who can help you with the execution of assignments on any topic. When I finished my course dealing related to java, I turned to service. Because they know good how to carry out the task, with their information skills, they have helped to me many times with such questions. During my study I close tree different subjects completely with their help.