java - How many objects are there? -
this question has answer here:
- what string pool in java? [duplicate] 4 answers
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
Post a Comment