Forums Register Login

Formatting Question

+Pie Number of slices to send: Send
Between


and


which one is it that we are to use? Javaranch says the former, many examples from Sun show the latter
+Pie Number of slices to send: Send
Hi Arthur,

There's no one correct way. For your own you should choose one of them, and use that in all your code. When you work for a company they usually have their coding standards so in that case use that of course. I personally prefer the second one.
+Pie Number of slices to send: Send
And I prefer the first one. Like Miklos said, the right version to use depends on the environment; if it's your own code simply choose one (1! 1! ) and stick to that.
+Pie Number of slices to send: Send
I prefer the second one, but that might just be because I learned CSS conventions in the same format.

Compilers of course doesn't recognize the line break there, so you could choose either one (as the guys above stated), and as you said, Sun shows the latter and JavaRanch shows the former. Both are probably the most widely accepted conventions for formatting, but I happen to see the second much more frequently (which means nothing about how you should write).


The other issue I have is whether or not to add a space after something like:


or



And also for arrays:


or



Head First Java has both at different times, and I'm not sure what the proper thing to do is. I tend to simply put the () or [] right next to the word it applies to, similar to how one would do with a method or when using an array reference, but I see it written in so many different fashions that it often makes me wonder what the more acceptable way is to do it, so I certainly understand your train of thought.


Take a look at this: http://www.javaranch.com/styleLong.jsp#format
I was born with webbed fish toes. This tiny ad is my only friend:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 766 times.
Similar Threads
Boolean
Difference of this.xxx and xxx
JAVA is not 100% casesensitive how???
Boolean: valueOf() and equality doubt
Not case sensitive boolean
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:20:29.