> For the complete documentation index, see [llms.txt](https://hanfak.gitbook.io/workspace/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hanfak.gitbook.io/workspace/languages/java/code-style.md).

# Code style

Every person/team has there own way of how to present their code. It is always good to have a consensus on this and stick to this. Even better is to have static anaylsis tools/tests which enforce this or use auto format in your IDE and set the style in the settings.

Here are some rules that I use:

* No new line after class or method declarations
* In tests, all fields, setups, teardowns should be moved to the bottom the class, so that tests are the first things you see.

## Here are some Links

* <https://google.github.io/styleguide/javaguide.html>
* <https://github.com/twitter/commons/blob/master/src/java/com/twitter/common/styleguide.md>
* <https://github.com/raywenderlich/java-style-guide>
* <https://gist.github.com/goldbattle/9283399>

Look at the chapter on formatting in Clean Code by Robert Martin
