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 is thread life cycle?

1024


How do I type unicode?

1022


What is the byte order of byte buffer?

1073


What is a "pure virtual" member function?

1144


What is hashing principle in java?

1078


What is the Scope of Static Variable?

1275


What is difference between static variable and global variable?

1111


What is the difference between a scrollbar and a scrollpane?

1110


What is the difference between static and non-static variables in java programming?

1028


What does provide mean construction?

1152


Explain the difference between map and flatmap stream operation?

1304


Why we cannot override static method?

1114


How do you change an int to a string?

1058


Is it possible to use string in the switch case?

1101


Is empty .java file name a valid source file name?

1178