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
In a container there are 5 components. I want to display the all the components names, how will you do that one?
What are scalar data types?
how to open and edit XML file in Weblogic???
Can we call virtual funciton in a constructor ?
What is a top level class in java?
What a static class can contains?
In java how do we copy objects?
When is update method called?
What is the final blank variable?
How do you declare a string variable?
What is 32 bit float?
Differentiate between array list and vector in java.
Explain about map interface in java?
Why we used break and continue statement in java?
How many bytes are a float?