Java Reference
In-Depth Information
Program style guide
J.1 Naming
J.1.1 Use meaningful names
Use descriptive names for all identifiers (names of classes, variables, and methods). Avoid
ambiguity. Avoid abbreviations. Simple mutator methods should be named setSomething(…).
Simple accessor methods should be named getSomething(…). Accessor methods with boolean
return values are often called isSomething(…) —for example, isEmpty() .
J.1.2 Class names start with a capital letter
J.1.3 Class names are singular nouns
J.1.4 Method and variable names start with lowercase letters
All three—class, method, and variable names—use capital letters in the middle to increase
readability of compound identifiers, e.g. numberOfItems .
J.1.5 Constants are written in UPPERCASE
Constants occasionally use underscores to indicate compound identifiers:
J.2.1 One level of indentation is four spaces
J.2.2 All statements within a block are indented one level
J.2.3 Braces for classes and methods are alone on one line
The braces for class and method blocks are on separate lines and are at the same indentation
level. For example:
Search WWH ::

Custom Search