Because in case there is already a String object "some text" in the heap, the first declaration refers to that object (from the String Literal Pool), while the second creates a new object in the heap which ends up with 2 identical objects for the same string in the heap.