How to know how many objects will be created with the following code?
<p>I am bit confused in case of objects when it comes to Strings, So wanted to know how many objects will be created with following code, with some explanation about String objects creation with respect to String pool and heap.   </p>

<pre><code> public static void main(String[] args) {

    String str1 = "String1";

    String str2 = new String("String1");

    String str3 = "String3";

    String str4 = str2 + str3;

    }
</code></pre>
