Naming Convention in Java

  • Naming conventions make programs more understandable by making them easier to read.

  • They can also give information about the function of the identifier-for example, whether it's a constant, package, or class-which can be helpful in understanding the code.

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

  • It is optional, but it is good practice to follow the naming convention .

Packagesshould be in lowercase letter e.g. java, lang, sql, util etc.
ClassesClass names should start with uppercase letter and be nouns, e.g. String, Color, Button, System, Thread etc..
InterfacesInterface names should be capitalized like class names.
Methodsshould start with lowercase letter and be a verb e.g. actionPerformed(), main(), print(), println() etc.
Variablesshould start with lowercase letter e.g. firstName, orderNumber etc.
Constantsshould be in uppercase letter. e.g. RED, YELLOW, MAX_PRIORITY etc.

Java follows camel-case syntax for naming the class, interface, method and variable.

If name is combined with two words, second word will start with uppercase letter always e.g. StringBuffer, actionPerformed(), firstName, ActionEvent, ActionListener etc.

Next topic is java-packages


Training For College Campus

We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.

Please mail your requirement at

Projects For Students

Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.

Students can mail requirement at

(8AM to 10PM):

+91-8527238801 , +91-9451396824

© 2017,, All rights reserved