Java Tutorial

Basic Concepts

Object Oriented Concepts

Coming Tutorials

>Home>Java Tutorial>Java Naming Standards Conventions

Java Tutorial

Basic Concepts

Object Oriented Concepts

Coming Tutorials



Java Naming Standards / Naming Conventions

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

Class names should be nouns, in mixed case with the first letter of each internal word capitalized. Interfaces name should also be capitalized just like class names.


Why should follow the Java naming standards?

  • To reduce the effort needed to read and understand source code.

  • To enable code reviews to focus on more important issues than arguing over syntax and naming standards.

  • To enable code quality review tools to focus their reporting mainly on significant issues other than syntax and style preferences.


Identifiers Type Description Example
packages Packages name should be in all lower case. com.topperskills
interface The interface name should start with a upper case character. Runnable, MyInterfaceName
class All the words of a class name should start with Upper case character Object, String, MyClassName
method Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized. print(), printMessage(), run(), actionPerformed()
variable First word should be in lower case, Internal words start with capital letters. Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. rollNo, firstName, lastName,
contant All characters should be in upper case. PAN_NO, ADHAAR

Share the article to help your friends