suppose string s1="rajnish";
string s2="bhaskar";
then what will be happend ?
Answer Posted / venkat
FIRST OF ALL THE JVM CREATED THE OBJECTS FOR STRING
CLASSESS IN TWO WAYS
1)STRING S1=NEW STRING("VENKI");
2)STRING S2="VENKI"
IN SECOND APPROACH WHEN THE JVM IS EN COUNTED THE ""
(DOUBLE QUOTATIONS) THEN IT UNDERSTOOD ,AND CREATED THE
OBJECT FOR THE S2 , AND THIS OBJECT IS PLACED IN THE STRING
POOL (SEPERATE MEMORY LOCATION IS MAINTAINED) . i.e in this
position we are not creating the object for the string class
explicitly ,the jvm internally created this object
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is the difference between the paint() and repaint() methods in java programming?
What are the differences between this and super keyword?
How do you do descending order in java?
What is boolean flag in java?
What are the main uses of the super keyword?
How do you add an element to an arraylist in java?
What does indexof mean?
What is the purpose of return statement?
Why stringbuffer is faster than string?
Which collection does not allow duplicates in java?
Can we access instance variables within static methods ?
What is array length in java?
Implement two stacks using a single array.
What is java regex?
What is meant by design patterns?