For an empty string, this is an object. He was instantiated by the object "", except that his 0-character-length content is empty.
The string variable can also store a special value, which is null, which is not associated with the other object and the variable. It's almost like an object that's not instantiated, it just defines an object.
Code testing
Package Study;public class MyString {public static void main (string[] args) {String str1=null; String str2= ""; System.out.println ("str1" +str1); System.out.println ("Str1" +str1.length ());/* * str1nullexception in thread "main" Java.lang.NullPointerExceptionat Study.myString.main (mystring.java:8) b error due to the absence of an object instantiation null pointer exception * */system.out.println ("str2" +str2); System.out.println ("Str2" +str2.length ());}}
See that the null pointer exception is not instantiated because it is being reported.
The difference between a Java hollow string and a null string