String object in java -


as know string immutable, means new instance created every time.

my question if write:

system.out.println("java"+"is"+"programming"); 

then how many objects created in pool?

your example create single string object in string pool.

after that, if do:

string x = "javaisprogramming"; 

it still point same object in string pool. can read more here


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -