info:java_style
Table of Contents
Java code style
Java does not enforce a particular code quality language-wise and therefor programmers should follow certain guidelines when writing code. As all guidelines, they might be violated for a good reason.
Classes
- All public class fields must be
final static
:public final static int MY_CONST = 3;
- Class members have to be named uppercase with underscore between words:
MAX_INTEGER
Objects
- All fields must be
private
and only accessible through getters and setters. - All fields must be
final
unless functionality requires mutability.
Constructors
- Constructors must not call any method unless it is
private
and in turn does not call any non-private method. - Fields assigned in the constructor must be
private final
info/java_style.txt · Last modified: 2015/03/10 08:20 by moritz