Quiz: Copying Strings
What is the value of greeting ? Remember to enclose strings in quotes. |
"Hello, World!" |
Of course, greeting has not changed. |
What is the value of greeting2 ? |
"Hello, World!" |
greeting2 has not changed either—toUpperCase is an accessor, not a mutator, and it returns a new string "HELLO, WORLD!" without mutating greeting2 . Remember the nasty cat! |
Be sure to watch the answer video. Sara will tell you a secret.