CS61B Style Guide
Author: Paul Hilfinger

Checking Program Style with style61b

On the instructional machines, you can run our version of the open-source checkstyle program with the command

 style61b FILE.java ...

where FILE.java... denotes one or more names of Java source files. The program will exit normally if there are no style violations, and otherwise will exit with a non-zero exit code.

Style61b' is a simple script that invokescheckstyleconfigured with our official style parameters. For home use, it is included in our cs61b-softwarepackage. The rest of this document details the style rules thatstyle61b` enforces.

Whitespace

Indentation

Braces

Comments

Names

Imports

Assorted Java Style Conventions

Avoiding Error-Prone Constructs

Limits