So far, we have learned primitive data types, which are the simplest types of data with no built-in behavior. Our programs will also use
Strings, which are objects, instead of primitives. Objects have built-in behavior.
Strings hold sequences of characters. We’ve already seen instances of a String, for example when you printed out
Just like with a primitive, we declare the variable by specifying the type first:
String greeting = "Hello World";
Create a variable called
openingLyrics that holds
"Yesterday, all my troubles seemed so far away".
System.out.println() to print out