...
Types and methods names are NOT abbreviated except for well-known cases such as EOF, Fifo, etc. See Abbreviation Rules for list of currently accepted abbreviations.
...
K&R bracket bracing and indentation style should be used. { starts on the same line as the opening block statement. For example:
Code Block | ||||
---|---|---|---|---|
| ||||
while (true) { if (false) body(); else if (true) { } else { } } |
Brackets Braces are required in all cases, even if not required by syntax, except for the cases when next statement is one-liner. The following code does not require brackets.For the latter, braces must not be used, e.g.:
Code Block |
---|
if (someCondition) a = b + c; |
...
When multi-line operator (try-catch, anonymous class instantiation, etc) goes after some condition it is required to use bracketsbraces:
Code Block |
---|
if (someCondition) { try { invocation(); } catch (Exception e) { e.printStackTrace(); } } |
...