HTML Java

Java Naming Convention


Naming Convention in java

In java, when we give name to identifiers such as package, class method, variables etc. There are some conditions which should be followed.It is not mandatory, but right way to do programming in java.

Class Name should be noun and start with uppercase. Try to keep name simple and descriptive. Example class Login.

Method Name Should be verb. First letter should be lower case and any internal word should start with uppercase example getData(),setData() Packages it should be in reverse order of domain com.sofstack.www Interface name Should start with uppercase UserInterface.

variable name Should start with lowercase. And don’t use any symbols lke $,@,% . example int x ,double y,String myName.

constants name Should be all uppercase. Separate words with underscore_ if more than one words. example MIN_WIDTH, MAX_LENGTH, COLOR.