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).
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here