Keeping things tidy

You have probably noticed that the Java code in our projects is indented. For example, the first line of code inside the SubHunter class is indented by one tab. And the first line of code is indented inside each method. Here is an annotated image to make this clear and as another quick example:

Keeping things tidy

Notice also that when the indented block has ended, often with a closing curly brace } that } is indented to the same extent as the line of code which began the block.

Tip

Android Studio does much of this automatically, but it does not keep things 100% organized, hence this discussion.

We do this to make the code more readable. It is not part ...

Get Learning Java by Building Android Games - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.