The documentation for the color names is capitalized, but the Lab#1 and Lab#2 use lower case arguments for the color names. Then Lab4a and b use upper case arguments - then back to lower case. since we are telling the students that java is case-sensitive and identifying upper/lower case errors as syntax errors, shouldn’t the color naming convention be consistent to match table?
Hi Rebecca, thank you for reaching out about this on the forum! I can see your confusion with the upper case vs. lower case working for painting colors. I tried various colors on Unit 1 lesson 2, I changed line 18 in several ways and it worked to paint an orange square for all of these:
So… while java is case sensitive for most things like variables (sofia is not the same as SOFIA) methods (takePaint vs takepaint) etc in this specific method one can use upper or lower case and still get the same color painted. This is because the color is a word (a String variable) inputted to the paint method. The writers of the method must have written is so that it will recognize the correct color regardless of how the user wrote it, possibly by using equalsIgnoreCase() in their work.
As you and your students move forward this observation could motivate a discussion of the difference between variables & methods which are case sensitive, and parameters. Programmers who write the code can make it more user friendly by adding code to recognize the parameters regardless of case.
I hope your year is off to a good start!