0
Suppose c is variable of type char. How would you test whether the value of c is single quote character?
2 Respuestas
+ 3
c == '\''
// Note that '' is 2 single quotes: '
Similar thing for double quotes in Strings:
String a = "\"a";
The value of a is: "a
+ 1
char c = '\'';
return c == '\'';
is one way to check if the value of c is the '.
or in the jshell, you can do:
char c = '\''
c == '\''
// output
$456 ==> true