/
How to write high-quality code (Java)

How to write high-quality code (Java)

For Java code, we will follow Google’s code style guidelines. Please read up on the guidelines. The only rule we change is the indentation. Instead of an indentation of 2, we use 4 spaces to indent the next level.

Step-by-step guide

You can set your Eclipse preferences to only use spaces (and avoid tabs) by doing the following:

  1. Go to Eclipse’s preferences
  2. Expand Java » Code Style
  3. Go to Formatter
  4. Click the Edit button
  5. Click the Indentation tab
  6. Set Tab policy to “Spaces only”
  7. Make sure “Indentation size” is set to 4.
  8. Click ok.
  9. Close the preference dialog.

 

Related content

How to get started on Github
How to get started on Github
More like this
How to write high-quality code (Python)
How to write high-quality code (Python)
More like this
Java Resources Home
Java Resources Home
More like this