In the first case, you declare a reference variable of string type and assign it a reference to a literal in the pool of constants. In the second case, you call the String constructor, passing it a reference to the literal, the constructor creates an object, initializes the field containing the character array in it, and copies the characters from the literal into this array. The reference returned by the constructor is assigned to the name variable. In both cases, the variable name is a string reference, but in the second virtual machine you will have to perform more operations and use more memory, since one instance of the string will be stored in the pool of constants, and the second in the heap.