help needed on inputting - tearing hair out .. please!!!



hey guys, i need help with a very annoying problem...

i am doing a program where the user inputs whether they think a random
number will be higher or lower than their own guess if it is not
correct... the problem im having is with the following code:


System.out.print(" Do you think the next number will be higher HI or
lower LO than " + x );

int y = in.nextInt();
String guess = in.nextString();

boolean correct = false;
if (guess.equals("HI"))
{
correct = (guess > y);
}
else if (guess.equals("LO"))
{
correct = (guess < y);
}
System.out.println("The number was " + y + " and you guessed " +
guess + " so you " + (correct ? "ROCK!" : "SUCK!"));

the main problem on the compiler is to do with string and guess....any
ideas what to do? my hair can't take anymore pulling..

.



Relevant Pages

  • Re: Problem with printing input.
    ... >> hey you rama krishna ... Prev by Date: ...
    (comp.lang.c)
  • Re: Error when openeing word
    ... > Please respond in the newsgroups so everyone can follow along. ... >> Hey all, ... >> MYOB has been installed on this system, can anyone help me with this? ... Prev by Date: ...
    (microsoft.public.word.application.errors)
  • Re: SUMIF - 2 conditions - with references
    ... > hey thanks for your help, i converted both columns to numbers but it ... > one condition the other condition is a date, so maybe that is affecting ... > vect98's Profile: ... Prev by Date: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: [OT] Stargate - To Answer Daves Question
    ... Not happy about that to be honest.....but hey, does it really matter? ... Dave ... Prev by Date: ...
    (uk.media.tv.sf.startrek)
  • Re: Bush says Cindy Sheehan is wrong
    ... Hey, when are you leaving to go search for those missing WMDs? ... Prev by Date: ...
    (rec.music.dylan)