Java Coding Standards

Java Naming Conventions (Sources: http://www.oracle.com/technetwork/java/codeconv-138413.html and http://geosoft.no/development/javastyle.html)

 
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.
 
Identifier Type
Rules for Naming              
Examples
Packages

The prefix of a unique package name is always written in all-

lowercase ASCII letters and should be one of the top-level domain names, currently com, edu, gov, mil, net, org.

Subsequent components of the package name vary according to an organization's own internal naming conventions.

 Such conventions might specify that certain directory name components be division, department, project, machine, or login names.

com.sun.eng com.apple.quicktime.v2 
edu.cmu.cs.bovik.cheese 
org.nordicstorm.robotics
Classes
Class names should usually be nouns, in mixed case with the first letter of each internal word capitalized. One exception to this rule is Commands, which should begin with a verb (like OpenClaw). Try to keep your class names simple and descriptive. Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML).
class Raster; 
class ImageSprite;
Interfaces
Interface names should be capitalized like class names.
interface RasterDelegate;
interface Storing;
Methods
Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.
run();
runFast();
getBackground();
Variables
Variables are in mixed case with a lowercase first letter. Internal words start with capital letters. Variable names should be short yet meaningful. The choice of a variable name should be mnemonic- that is, designed to indicate to the casual observer the intent of its use. One-character variable names should be avoided except for temporary "throwaway" variables. Common names for temporary variables are i, j, k, m, and n for integers; c, d, and e for characters.
int i;
char c;
float myWidth;
boolean isFinished;
Constants
The names of variables declared class constants should be all uppercase with words separated by underscores ("_")
static final int MIN_WIDTH = 4;
static final int MAX_WIDTH = 999;
static final int GET_THE_CPU = 1;
Class variables
(TEAM SHOULD DECIDE) several options are common:
Underscore prefix
Underscore suffix
m_ prefix
nothing
private _bms;
private bms_;
private m_bms;
private bms;
get/set methods
get/set methods should be created to access class variables instead of accessing them directly.
employee.getName();
employee.setName(name);
Acronyms
Abbreviations and acronyms should not be uppercase when used as name.
Using all uppercase for the base name will give conflicts with the naming conventions given above. A variable of this type would have to be named dVD, hTML etc. which obviously is not very readable. Another problem is illustrated in the examples above; When the name is connected to another, the readability is seriously reduced; The word following the acronym does not stand out as it should.
exportHtmlSource(); // NOT: exportHTMLSource();
openDvdPlayer();    // NOT: openDVDPlayer();
Abbreviations
Abbreviations in names should be avoided.
computeAverage();
 // NOT: compAvg();
ActionEvent event;
 // NOT: ActionEvent e;
catch (Exception exception) { 
 // NOT: catch (Exception e) {
Formatting Use 4 spaces to indent code. Use the block formatting style as demonstrated with curly braces not lined up.
while (!done) { 
    doSomething();
    done = moreToDo();
}