Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How many objects are created when we create String class
object using new operator?

Answer Posted / ravi

Eknath Wagadre is correct, Check this programme.

String s1 = "this is string";
String s2 = new String("this is string");

System.out.format("S1: %d, S2:%d \n",s1.hashCode(),s2.hashCode() );
System.out.println(s1.hashCode()==s2.hashCode() );

The both s1 and s2 have same hashCode, means only one object created.

Is This Answer Correct ?    0 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What programs use java?

945


How big is a 64 bit float?

1024


What is the purpose of garbage collection in java? When is it used?

1043


What are sets in java?

935


What is difference between java and java ee?

1022


What does system.gc() and runtime.gc() methods do?

1045


What is the difference between throw and throws keywords?

1047


Where are local variables stored?

961


What is string made of?

950


Can a function return a function?

1032


What is purpose of find feature?

1074


How does thread synchronization occurs inside a monitor? What levels of synchronization can you apply?

958


What are actual parameters?

1028


What is method in java with example?

941


How does enum work in java?

1014