title: In Java Is it efficient to use new String() instead of double quotes when string is really large and not using again?
body: <p>I have so many use cases where I have to initialize a large string and not use the same string anywhere else.</p>
  <pre><code>//Code-1
  public class Engine{
  public void run(){
      String q = &quot;fjfjljkljflajlfjalkjdfkljaflkjdllllllllllllllsjfkjdaljdfkdjfnvnvnrrukvnfknv&quot;;
      //do something
     }
  }
  </code></pre>
  <p>I call this run method very few times.</p>
  <p>In Code-1 the string <code>fjfjljkljflaj.....</code> will get added to the string pool and will never get collected by GC. So I am thinking to initialize with the new operator.</p>
  <pre><code>//Code-2
  public class Engine{
  public void run(){
      String q = new String(&quot;fjfjljkljflajlfjalkjdfkljaflkjdllllllllllllllsjfkjdaljdfkdjfnvnvnrru&quot;);
      //do something
     }
  }
  </code></pre>
  <p>Will 2nd code save some memory or there will be other factors to consider to decide which one is efficient?</p>