Meaningless Drivel is fun!*
The moose likes Cattle Drive and the fly likes Assignment 2 - question on string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Assignment 2 - question on string" Watch "Assignment 2 - question on string" New topic
Author

Assignment 2 - question on string

John Peters
Greenhorn

Joined: May 25, 2007
Posts: 18
I noticed in the solution that the string variable indicating whether the number is "even" or "odd" is declared and initialized to "odd". Then if the number is even, the string is changed to "even". Is there a performance or optimization reason for arranging the code like this?
Brian Holsenbeck
Greenhorn

Joined: Jul 01, 2008
Posts: 8
I asked the same question after the java3 assignment. The reply was that it was shorter, but still very readable.
John Peters
Greenhorn

Joined: May 25, 2007
Posts: 18
That makes sense.
Thanks, Brian.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assignment 2 - question on string