title: string return by java.sql.ResultSet.getString() and its bytecode interpretation
body: <p>Consider two lines from code:</p>
  
  <pre><code>...
  rs.next();  //rs is ResultSet interface.
  rs.getString("name");
  ...
  </code></pre>
  
  <p>Byte code generated by <strong>javap</strong> is :</p>
  
  <pre><code>...
  35:  invokeinterface #9,  1; //InterfaceMethod java/sql/ResultSet.next:()Z
     40:  pop
     41:  aload   4
     43:  ldc     #10; //String name
     45:  invokeinterface #11,  2; //InterfaceMethod java/sql/ResultSet.getString:
  (Ljava/lang/String;)Ljava/lang/String;
     50:  pop
     51:  aload_2
     52:  invokeinterface #12,  1; //InterfaceMethod java/sql/Connection.close:()V
  
   ...
  </code></pre>
  
  <p>I am trying to interpret this bytecode.</p>
  
  <p>For line <code>rs.getString("name");</code> bytecode starts from line 43 to 51.</p>
  
  <p>1)At line 45 method is <strong>INVOKED</strong> and a string object is returned as represented by Ljava/lang/String.Is this right <strong>OR</strong> here, only method is being loaded from constant pool with index #11 TO STACK and executed at line 50 ???</p>
  
  <p>2) where does the string object returned by <code>rs.getString("name");</code> lies? on stack or on heap as i think aload_2 is pushing some value on stack.</p>
  
  <p>Actually here, i am confused in the following:</p>
  
  <p>If suppose i have :</p>
  
  <pre><code> ...
  rs.next();
  rs.getString("name");
  rs.getString("name");
  rs.getString("name");
  rs.getString("name");
  ...10 more times...
  ...
  </code></pre>
  
  <p>and all return a same name. Then there will be 10 different string objects with same value.So it will be memory wasting and is a case for using intern(). But if these will be on stack then will it still be considered as memory wastage and need intern()???</p>
  
  <p>3) I think string object returned by <code>rs.getString("name");</code> is not an interned string so definitely it will not be on Permanent Generation memory area??</p>