This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Taking the breaks and continues out of code

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some code that runs fine, but it has all these breaks and continues that make it ugly. Can you give me some tips to rewrite it?


(edited by Cindy to format code)
[This message has been edited by Cindy Glass (edited February 23, 2001).]
 
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,
It would be easier to read your loonnnnggggg example if you formatted your code to make it more readable. Please read the FAQ to learn how.
Thanks,
-Peter
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David,
Here is the way I did it... there are propably others too...

HTH,
-Nate
[This message has been edited by Nathan Pruett (edited February 23, 2001).]
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure that putting in lots of System.exit() calls is what was wanted. One of the main problems with the example given is that it is all in the main method. This just about makes sense in a program this small, but for anything larger you really should split it into smaller methods and classes. Here's another rewritten version, with things split off into (I hope) understandable concepts and operations. It's a bit more wordy, but I really do think it is more maintainable. See what you think...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!