×

Html & Html5

The World's best Software Development Study Portal

Naming convention

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

All the classes,interfaces,packages,methods of java programming language are given according to java naming convention.

Note:Naming convention are not rule and it is not compulsion to follow them.That's why these are called conventions.

Advantages of naming convention:

  • It makes efficient readibility of java code which is beneficial for yourself and other programmer.It also makes you look professional.

Concept of Camel case in naming convention:

Java is case sensitive.Using the right case is key to following a naming convention.Java follows camel case for naming.

Camel case is that where each new word begins with a capital letter.For.eg. CustomerServices,PlayingCricket etc.


How to write conventions:


Name Conventions
1.Class name Should start with uppercase letter and be noun.e.g.Color,String etc.
2.interface name Should start with uppercase letter and be an adjective.e.g. Remote,Action etc.
3.method name Should start with lowercase letter and be a verb. e.g.main(),print()etc.
4.variable name Should start with lowercase letter,e.g. firstName etc.
5.package name Should start with lowercase letter.e.g.java,lang etc.
6.constant name Should start with uppercase letter.e.g.RED,MAX_PRIORITY etc.