Java Specifics

    A Java source program is composed of
white space, comments, declarations, and statements.



    White space is a very important part of any Java program
    • has no effect on the code's meaning
    • enhances readability and communicates structure
    • includes, spaces, tabs, and new lines.
    • typically, tabs or indention set off blocks of code
    • new-lines separate statements

    There aren't hard-fast rules on using white space.

Adopt a consistent style!
Lecture 2 Slide 5 6.837 Fall '98

A Java source program is composed of white space, comments, declarations, and statements.

White space is a very important part of any Java program. While it has no effect on the meaning of the code, white space, more than any other factor, contributes to the readability and signals the structure of a code fragment. White space includes, spaces, tabs, and new lines. Typically, tabs or indention is used to set off blocks of code, and new lines are used to separate statements. There are no hard-fast rules how and when to use white space, all I suggest is that you adopt a consistent style.