File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Cattle Drive and the fly likes Formatting - Spacing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Formatting - Spacing" Watch "Formatting - Spacing" New topic

Formatting - Spacing

Sean Webster

Joined: Aug 24, 2002
Posts: 21
Can anyone tell me the proper spacing rules.
In the assignment tutorial, I see:
System.out.println( "Spot is now home" );
***Notice the space after the println method parentheses and the string
In the style guide, I see:
System.out.println("Oatmeal is good and good for you");
***notice the no spacing between the parentheses and the string. Which is correct, or does it even matter?
This is my understanding of the spacing rule:
1 - all identifiers are surrounded with whitespace unless it reduced clarity
2 -note the exceptions in the style guide (methods, arrays, pre and post increment, and casting)
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
I'm whispering so only you will hear this...
There would appear to be a couple of inconsistencies regarding the style guide and what is actually expected. Mostly to do with some spacings not addressed in the style guide.
A rule that should get you by: If you were to surround all of your String literals with spaces, you would not be in error.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Formatting - Spacing
It's not a secret anymore!