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
Is hashset ordered?
What are the advantages of inner classes?
How many types of methods are there?
What is the purpose of a transient variable?
What are passing parameters?
What is variable and example?
Give an example of use of pointers in java class.
Can we override tostring method in java?
How many times finalize method will be invoked? Who invokes finalize() method in java?
How are the elements of a gridbaglayout organized in java programming?
How to compare two strings in java program?
What is the difference between method and means?
What exactly is a .class file?
What is the use of default method in interface in java?
What is substring 1 in java?