state is 1 and
current is 'm'.
Does the following evaluate to true
( state==1 && current >= 'a' && current <= 'y')
The set of characters that Java uses are arranged
in a sequence, called the
Every character can be compared to any character.
Character 'a' comes earlier in the sequence than 'z'.
'a' < 'z'returns true
'a' > 'z'returns false
'a' <= 'z'returns true
'a' >= 'z'returns false
'a' == 'z'returns false
This is useful if you wish to test for a range of characters. Here is part of the collating sequence for ASCII:
. . . 0123456789 . . . ABCDEFGHIJKLMNOPQRSTUVWXYZ . . . abcdefghijklmnopqrstuvwxyz . . .
There are non-alphabetic characters between the sequences '0' to '9', 'A' to 'Z', and 'a' to 'z'. It is good programming practice to test for ranges of characters only within one of these sequences.
current >= 'a' && current <= 'y'is good
current >= 'A' && current <= 'y'is poor practice
current >= '0' && current <= '9'is good
current >= '0' && current <= 'A'is poor practice
'1' < '5' evaluate to true or false?