I am trying to concatenate 4 strings together to later be able to make them all upper case, or lower case or get the length. I keep getting an error on line 16.
Java is smart enough to realize that msg1, msg2, msg3 and msg4 have not been assigned values. So when you try to concatenate them, Java calls foul. It doesn't make sense to concatenate non-values.
You are assigning them values in your code, just later. So move the concatenation statement to after that happens. Remember that the program will do things when you tell it to. Literally.
Technically, " " is not an empty string; it's a string with one character that happens to be a space. An empty string has no characters and is represented by "" (nothing between the two quotes).
Junilu Lacar wrote:Technically, " " is not an empty string; it's a string with one character that happens to be a space. An empty string has no characters and is represented by "" (nothing between the two quotes).