The simplest way to declare a primitive string is using single or double quotes. Creating an object requires the use of the keyword new String()
with a parameter. If you ever want to explicitly declare a primitive string, you can also use the String(stringObject)
as shown above to perhaps convert a string object to a primitive data type. The property of all three of these strings can be accessed in the same way using the dot notation as shown above.