PPT Slide
Again, Java automatically creates a new String object whenever it encounters text within double-quote marks.
String str1 = “Hello World”; accomplishes three things:
1. It creates str1 as a reference to a String.
2. It creates an instance of a String. 3. It initializes that String to “Hello World”.
This is inconsistent with how Java
With standard objects, you must explicitly:
instantiate (via new), and
initialize (via a constructor).
Strings vis-a-vis Objects