• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about { } notation

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can I use the
public class A
{
public void method()
{
...
}
}
instead of
public class A {
public void method() {
...
}
}
braces coding convention???
I've read the sun coding conventions but nothing is written about it.
Thanks
 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
to me this looks better ..
class Example{
// void method(){
// }
}
ignore the //
what do you say ?
cheers,
parthi
[ October 17, 2002: Message edited by: parthiban subramaniam ]
[ October 17, 2002: Message edited by: parthiban subramaniam ]
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry,the original message was something like
public class A
{
// public void method()
///{
///}
}
instead of
public class A {
// public void method(){
///}
}
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if it compiles i don't see why you can't use it, but it's not on the way of the Code Conventions for the JavaTM Programming Language, just take a look at the example file

[ October 17, 2002: Message edited by: Jaun Katabasis ]
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can answer this one with certainty, because this was just confirmed: you MUST follow the official Java Coding Conventions. You will have points deducted if you don't, no matter how consistent you are. There has been confusion about this, because the exam instructions often just said, "coding standards" without specifying WHICH standards, so now it's been finalized.
And unfortunately, that means...
public void go() {

}
cheers,
Kathy
p.s. the good news is, you may spend the rest of your life and never have to adhere to that particular style guide, but for the exam, you can assume that Sun is your client, and they require you to use their conventions.
 
Andrea Gazzarini
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to everyone..!!
 
Ranch Hand
Posts: 2378
MySQL Database Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I always liked the
while(true){
... if(i>=0){
....i+=10;
..}
}
like things due to a touch of elegance. And now I am confirmed it's official also.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the difference between a Java developer and a Java programmer could be that you have the opening bracket on the same line as the method name and the if stmt and so forth. Fantastic !
/T
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Torgny Wikstr�m:
So the difference between a Java developer and a Java programmer could be that you have the opening bracket on the same line as the method name and the if stmt and so forth. Fantastic !
/T


Sarcasm doesn't do you any good. We all probably, at some point in time, have rolled our eyes at such seemingly trivial things like this but that's the world we have to live in. It's been said that what differentiates a professional is his/her ability to do the job well even if he/she doesn't like it. As Kathy said previously, you should think of Sun as your client for this project. As the client, Sun has the right to demand things such as adherence to a coding convention and the developer should be obliged to stick to it. If you don't like it, you can either suck it up and comply anyway or be bull-headed and ignore it. If you choose the latter, then, as in real life, you should be prepared to take the consequences.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since there are beautifiers to get, and run, it's no big deal. But, deducting points if the bracket is on the "wrong" line is. The compiler doesn't care. If you get pointe of for some strange design that's understandable or if your code looks like a complete mess.
/T
reply
    Bookmark Topic Watch Topic
  • New Topic