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

In a container there are 5 components. I want to display the all the components names, how will you do that one?

1011


What are scalar data types?

1006


how to open and edit XML file in Weblogic???

1941


Can we call virtual funciton in a constructor ?

2157


What is a top level class in java?

983


What a static class can contains?

1115


In java how do we copy objects?

1009


When is update method called?

1106


What is the final blank variable?

1090


How do you declare a string variable?

979


What is 32 bit float?

951


Differentiate between array list and vector in java.

1080


Explain about map interface in java?

959


Why we used break and continue statement in java?

1085


How many bytes are a float?

945