java - How many objects are there? -


this question has answer here:

string s1=new string("rahul"); s1=new string("rahul"); s1=new string("kumar"); string s2=new string("rahul"); s2=new string("rahul"); s2=new string("kumar");  

// how many objects created?

every new string(...) creates new object. in example 6 objects created.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -