S
Shanknbake
Hi, this is my first java class..and I'm writing a program in which i
need to allow the user to "continue by pressing the enter key, or q to
quit"...how to I check if the user has entered the enter key?
Code:
do
{
//...body code
//...body code
//bottom of do/while statement
System.out.println("If you would like to quit, type 'q', otherwise
press any [enter] to continue");
quit=keyboard.next();
}
while(quit.equalsIgnoreCase("\n")); //how do i check if enter key
is pressed?
}
}...
quit is a String variable...not a char
plz help this
thanks
need to allow the user to "continue by pressing the enter key, or q to
quit"...how to I check if the user has entered the enter key?
Code:
do
{
//...body code
//...body code
//bottom of do/while statement
System.out.println("If you would like to quit, type 'q', otherwise
press any [enter] to continue");
quit=keyboard.next();
}
while(quit.equalsIgnoreCase("\n")); //how do i check if enter key
is pressed?
}
}...
quit is a String variable...not a char
plz help this
thanks