There is nothing wrong with the program.
Since color
is a primitive data type,
an expression such as
color == 'V'
compares the contents of color (a character) to the character literal 'V'. However, the following would be wrong:
color == "V"
This is asking to compare the character value in color
with a reference to the String object "V".
This is the end of the chapter. A strong case can be made for reviewing the following subjects.
switch
statement.
break
statment.
The next chapter will discuss the do
statement.