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 / rana

Answer is 2

String s = new String ("ABC"); // creates new obj in heap and adds entry in literal pool
String s1 = s.intern(); // fetches the existing object's value.
System.out.println(s1);

@Ravi
String hashCode has generic mechanism as below.

s[0]*31^n-1 + s[1]*31^n-2 ....+s[n-1]

n - length of string
s[0] - ascii value of the character

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is call by reference possible in java?

906


What are the basics of core java?

960


Explain the importance of import keyword in java?

939


Which is faster call by value or call by reference?

864


What is bytecode verifier?

877


What are static methods?

989


Give me some null interfaces in java?

1006


Is multiple inheritance supported by java?

922


What is set and get methods in java?

925


How do I get 64 bit java?

1009


How many types of design patterns are there?

1043


What is bubble sorting in java?

992


What is pre increment and post increment in java?

941


What is sortedset in java?

975


Explain about map interface in java?

943