- Each top-level class resides in a source file of its own.
Following order of the elements of the class is mandatory:
-
final
,static
fields in following order:public
protected
package-private
private
public
enum
-
static
fields in following order:public
protected
package-private
private
static
initializer block-
final
fields in following order:public
protected
package-private
private
-
fields without modifiers in following order:
public
protected
package-private
private
- initializer block
static
method(s)- constructor(s)
- methods(s) without modifiers
- enums(s) without modifiers
- interfaces(s) without modifiers
- inner
static
classes - inner classes
In addition:
- Getters and Setters are kept together
- Overloads are never split - multiple constructors or methods with the same name appear sequentially.