You denote a particular character by surrounding that character with single
quotation marks, thus distinguishing the character from, say, a variable
name. For example, you denote the character
M by writing 'M'
.
If you want to see whether you have extracted a particular character, you
compare what you have extracted with that character. Then, if you wish,
you can center an if
statement on that comparison, as in the following
example, which executes the block only if the first character in the string
is M:
if (codeString.charAt(0) == 'M') { ... }