Coding style

Bruce Eckel’s Thinking in Java Contents | Prev | Next

The
unofficial standard in Java is to capitalize the first letter of a class name.
If the class name consists of several words, they are run together (that is,
you don’t use underscores to separate the names) and the first letter of
each embedded word is capitalized, such as:

class
AllTheColorsOfTheRainbow { // ...

For
almost everything else: methods, fields (member variables) and object handle
names, the accepted style is just as it is for classes
except
that the first letter of the identifier is lower case. For example:

class AllTheColorsOfTheRainbow {
  int anIntegerRepresentingColors;
  void changeTheHueOfTheColor(int newHue) {
    // ...
  }
  // ...
}

Of
course, you should remember that the user must also type all these long names,
and be merciful.

More by Author

Must Read