CONTENTS | PREV | NEXT Java Code Conventions


4.1 Number Per Line

One declaration per line is recommended since it encourages commenting. In other words,

int level; // indentation level
int size; // size of table
is preferred over

int level, size;
In absolutely no case should variables and functions be declared on the same line. Example:

long dbaddr, getDbaddr(); // WRONG!
Do not put different types on the same line. Example:

int foo, fooarray[]; //WRONG!


Note - The examples above use one space between the type and the identifier. Another acceptable alternative is to use tabs, e.g.:
int	level;				 // indentation level
int size; // size of table
Object currentEntry; // currently selected table entry


CONTENTS | PREV | NEXT
Copyright © 1997 Sun Microsystems, Inc. All Rights Reserved.