Two Laptop Bag
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes What about line wrap? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Professional Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "What about line wrap?" Watch "What about line wrap?" New topic
Author

What about line wrap?

Seetharaman Iyer
Ranch Hand

Joined: Jun 25, 2010
Posts: 35
Hi,

I need a help regarding line wrap. I use 65 characters / some cases max 80 characters as a limit. I have some scenarios like

1)
} catch (FileNotFoundException e) {
...
throw new ServiceStartFailureException(MsgConstants.DBPATH_NOT_EXIST);
}


2)
} catch (ServiceNotRunningException e) {
...
return ErrorResponse.prepareErrorResponse(MsgConstants.SERVICE_UNAVAILABLE);
}

Please tell me how to break these lines.

Your help is much appreciated!
Seetha...

This message was edited 1 time. Last update was at by Roel De Nijs

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 3740

Hi Seetharaman,

I just used the formatter of Eclipse which I tweaked a bit (80 characters per line for example) and used just this formatter in every source file.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Martin Krischik
Greenhorn

Joined: Apr 29, 2010
Posts: 23

Hi Seetharaman,

Seetharaman Iyer wrote:Please tell me how to break these lines.


Any way you like. I used Allman style instead of the Sun Style and still passed. I did describe my style choices in the first chapter of choices.txt .

And just like Roel I let Eclipse do all the work.

Martin


SCJP, SCJD, OCPJBCD
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2114

Howdy, Martin!

Champ, one curiosity, when did you pass the exam? Did you have access to your detailed score? I suspect that, if you don't follow Sun's code conventions, then you can lose points in the "General Considerations" criteria. I'm not sure, though.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 3740

Roberto Perillo wrote:when did you pass the exam?

August 18, based on this thread so no detailed score anymore

This message was edited 1 time. Last update was at by Roel De Nijs

Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2114

Roel De Nijs wrote:August 18, based on this thread so no detailed score anymore


So congrats there and here, Martin!
Martin Krischik
Greenhorn

Joined: Apr 29, 2010
Posts: 23

Hi Roberto,

Roberto Perillo wrote:Did you have access to your detailed score?


As I said no access to detailed scores for passes. I guess it is another measurement against fraught. On the other hand it makes the whole SCJD a guesswork. If you are concerned: Code the way you like it best (after all you have to read your own code most of the time) and at the end run the code through a carefully set up Eclipse cleanup/format at the end.

Martin
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2114

Martin Krischik wrote:Code the way you like it best (after all you have to read your own code most of the time) and at the end run the code through a carefully set up Eclipse cleanup/format at the end.


Agreed. One good tip is to prepare Eclipse's formatter to follow Sun's code conventions (as described here).
Martin Krischik
Greenhorn

Joined: Apr 29, 2010
Posts: 23

Roberto Perillo wrote:(as described here).


»The Code Conventions for the Java Programming Language document was revised and updated on April 20, 1999.«

Gosh, that has not been updated in 11 years.

This message was edited 1 time. Last update was at by Martin Krischik

Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 3740

Martin Krischik wrote:Gosh, that has not been updated in 11 years.

Never change a winning team
Martin Krischik
Greenhorn

Joined: Apr 29, 2010
Posts: 23

Roel De Nijs wrote:Never change a winning team


But Team has changed: It now has generics!
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 3740

Martin Krischik wrote:It now has generics!

Hm, generics you say That's new to me, I'll have to do some investigation about these generics
 
 
subject: What about line wrap?
 
developer file tools