This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
As far as spacing goes within parentheses, you're generally OK with any of those options in your subject and the examples you cite. (Check the Style Guide for exceptions.)
Though the Style Guide doesn't require you to stick with one or the other, I think your idea to choose one and stick with it is a good approach. I think there's something about consistently formatted code that makes it easier on tired eyes (and brains) to read and grasp.
You'll see it soon enough: readability is Big Thing 'round these parts.
Have fun! Pauline [ November 04, 2006: Message edited by: Pauline McNamara ]
Joined: Oct 09, 2006
How are you?
Looking forward to number 5...... (of course, that means you give me the green light on 4b! ).
I see there is a whole bunch of us on 4b..............
Perhaps we could send a posse round
Hope the weather is Ok in Switzerland - sunny and cold here.
Joined: Jan 19, 2001
Only went and typed (int) - note there are no spaces!!!
Actually, if this was part of a cast, the (int) is fine. If I remember correctly, that nitpick was about another part of that same cast...
Anyway, here's what the Style Guide says about casts and spacing:
The Style Guide used to require spacing around all identifiers, which is why you see the space between the identifier and the parenthesis. However, that constraint has recently been lifted. I would think, however, that your code would be more readable if you choose one way and use it consistently (unless the nitpicker or Style Guide tells you otherwise for a particular situation).
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Nov 03, 2006
Thank you for helping me out on this one. I think I will leave the rest of the discussion for future nitpicks.