This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Ok so I am new to this forum.. and somewhat new to java ..
I have this program that I am running and for some reason it is missing the first part of it.
it odes not ask for the age sex, voter party or who is voted for.
can someone please help me out with this.
When you are comparing the contents of two strings, don't use the == operator. That just checks whether its operands are the same String object, which isn't helpful because two different String objects can contain the same text.
You already knew to use the equals() method elsewhere. Use it everywhere you compare two String objects.
Thomas Kelley wrote:can someone please help me out with this.
I think everybody else has pretty much told you the procedural problems, but the basic problem with your program to me is that it is procedural. Java is an Object (or, if you like, Class) oriented language, and Strings usually make bad substitutes for other classes.
My tip: Have a think about creating Party and Sex classes (no snickering in the back row).
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here