Different Java programmers have their own style of writing code. While that may work while working alone, it may become difficult to understand and maintain such code in a team environment.
Following standard naming conventions helps make the code readable to yourself and your fellow programmers.
Here are some standard naming conventions that your may refer to :
Packages
Package names are written in all lowercase characters. The prefix of package name is always written in all-lowercase ASCII letters and should be one of the top-level domain names, like com, edu, gov, mil, net, org.
The subsequent portions follow organization’s own naming conventions.
com.topjavatutorial.jdbc
com.mysql.jdbc
Classes and Interfaces
Classes and Interfaces always start with a capital letter, and are CamelCase:
Employee
Exception
Integer
Variables and Methods
Variables and methods always start with a lowercase letter, and are camelCase too:
int someNumber= 10;
public void doSomething();
Constants
static final instance variables can never change, and are therefore constant. The convention for constants is to be all uppercase, with any breaks between words represented by an underscore:
public static final int HTTP_OK = 200;
private static final String SUCCESS_RESPONSE = “YES”;
Reference :
http://www.oracle.com/technetwork/java/codeconventions-135099.html
© 2017, https:. All rights reserved. On republishing this post, you must provide link to original post