When I run the Javac, it tells me that i have an incomparable data types char and String in the
while(responseChar == \"y\")
not sure what
Optionally you could use the big C Character
class to convert your char
to a String
:
String converted = Character.toString(responseChar);
while(converted.equalsIgnoreCase("y"))
{
// ...
}
But this version is much more verbose than the literal comparison suggested by Jeffrey
To define a character literal, use a single quote: '
. Double quotes define string literals.
while(responseChar == 'y')
Instead of "y"
do this 'y'
. ""
Represents string.