Java Quick Guide

This guide contains useful Java information.

Java Code Conventions.

The Java Code Conventions documentation can be found online on the website, see:

Other interesting Java programming style guidelines can be found at:

Sometimes you see pre-fix (= Hungarian notation) naming conventions applied to variable names to provide semantic meaning to the field. To explain what they mean an overview is given.

You should NOT use the Hungarian notation, which specifies type as part of the identifier, because it violates object oriented abstraction.

Pre-fix naming conventions (= Hungarian notation).



m_ indicates class variable names. Seperates class variables from local variables.

public class Demo {
   public int m_height = 1;
   public int m_width = 10;

   public Demo(int height, int width) {
      m_height = height;
      m_width = width;

Instead of m_ sometimes _ is used:

public class Demo {
   public int _height = 1;
   public int _width = 10;

   public Demo(int height, int width) {
      _height = height;
      _width = width;

s String variables

public String sName;

b Boolean variables

public boolean bValid;

v Vector variables

public Vector vList;

e Enumeration variables

public Enumeration eSelection;

o Object variables

public Object oNextElement;

i Integer variables

public Integer iHeight;

  int variables have no pre-fix.

public int height;

ht Hashtable variables

public Hashtable htProperties;

exc Exception variables

public Exception excMessage;