When I code in Java, this is what it looks like:
Every opening and closing brace containing code is on a separate line, and every block’s contents are indented. I prefer the “next line” opening brace method over the “same line” method for a couple of reasons:
- It’s easier to match opening and closing braces.
- To me, having braces at the same indentation level creates a better appearance of a block of code.
To change your indenting and braces settings in Eclipse, go to Window > Preferences > Java > Code Style > Formatter. Create a new profile for yourself, then edit your settings to your liking.
Alternatively, here is my current Eclipse Java formatter profile, if my style works for you.