• 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

Confused about a line wrap

 
Ranch Hand
Posts: 81
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What would be the best way to wrap this line of code?


Thanks,
Greg Funston SCJP
 
Ranch Hand
Posts: 222
Google Web Toolkit Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd do it like this:
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have told this already quiet a few times: line wrapping is all in the courtesy of my IDE (Eclipse). I use the default built-in formatter with a few small changes (chars per line = 80) and I format each source file with this formatter. How lines are wrapped is not my concern, but I'm guaranteed all lines are formatted in the same way
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, Greg!

How about the following:

 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Roberto. I normally think of stuff like that. I must be getting burnt. LOL.

Also thanks Elchin. That is where I put the break. Seemed the right place, but I prefer Roberto's.
It is cleaner.

Scheduled exam for this week. Can't wait to be done.

Cheers,
Greg Funston SCJP
 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel said

line wrapping is all in the courtesy of my IDE (Eclipse).



Yes, I downloaded the Eclipse IDE and spent a few minutes with it but I stopped shortly afterwards. I was
worried the learning curve would slow my project time down. I need to start using it because a lot of firms
use Eclipse. Maybe it is time before I submit to get familiar just for the code formatting.

Thanks to All.
Greg Funston SCJP
 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Roel, What version of Eclipse do you use? Do the Eclipse versions change much? I seem to recall you mentioned in a previous post the version and it was not a freeware version. I think I looked it up and it was $30 approx. My memory could be wrong though and maybe it was someone else.

Cheers,
Greg Funston SCJP
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Eclipse version is always for free! If you want to use MyEclipse you can choose between different versions depending on your needs, but you'll have to pay (compared with other tools it's still very cheap). But for OCMJD I just used the latest version of Eclipse for Java Developers. And I used MyEclipse at a former company, so could be me Now just using Eclipse (for RCP and RAP Developers, combined with the WTP).

And as a side note: not using an IDE at all for developing your assignment I guess you just used a text editor and java/javac commands I'm pretty sure you spend a bunch of unneeded hours. Investing 2-3 hours in basic use of Eclipse would have saved you days, maybe even weeks (generating getters/setters, javadoc generation, formatting, detecting compiler errors due to typos,... you get it all for free)
 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've been using netbeans which is a good IDE and I am familiar with it. It has been extremely good.
If it has an auto_formatter I have not found it yet, but then again I was not really looking for it. If I had
an auto formatter it may have saved me a few hours at the most. I am in the process of going over
every line of code right now to make sure I have nothing I do not want in there as well as enough comments etc.

Manual formatting of the comments will cost me a little time but not a lot. It forces me to look at each line of code
in detail.

Cheers,
Greg Funston SCJP

 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to hear you didn't develop the assignment using a text editor and java/javac

If you use NetBeans you can continue with that one, it's indeed a good IDE and I guess they work almost the same (I used it in the end of last year during 2 courses and had no real difficulties). NetBeans certainly has a code formatter (a simple google lookup confirms). If this formatting can be automatically invoked by each save action (like in Eclipse) I do not know.
 
reply
    Bookmark Topic Watch Topic
  • New Topic