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
How do you execute a thread in java?
What are the different types of constructor?
What do you understand by copy constructor in java?
What is numeric function?
Which of the following is not an isolation level in the JDBC
What is parse method?
What is casting in java programming?
What do you mean by byte code?
What is the difference between a factory and abstract factory pattern?
Difference between error and exception
What is the purpose of declaring a variable as final?
Explain how can you debug the Java code?
What do you mean by mnemonics?
What is string builder in java?
2) Suppose there are 5 directories having lot of files (say txt files) in each directory. 2 things :- 2.1) You want to search for filenames which have a particular pattern. 2.2) Out of these filtered files you want to search for a particular keyword or a search string. How can you achieve this?