suppose string s1="rajnish";
string s2="bhaskar";
then what will be happend ?
Answers were Sorted based on User's Feedback
Answer / tck
It shows the systex error,The String is the final class in
java the syntax for string class is
String s1="rajinesh";
String s2="bhaskar";
so we have to declare the string variables like this .
| Is This Answer Correct ? | 8 Yes | 3 No |
Answer / 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 |
Answer / aruna raman
'S' should be in capital for string.. Java is case
sensitive, then it will run successfully.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / tejas gowda
Two String Object run successfuly and will be saved in the
heap memory
| Is This Answer Correct ? | 0 Yes | 8 No |
Define how does a try statement determine which catch clause should be used to handle an exception?
why there are multiple catches for a try block.don't tell me that there can be multiple exception of a code segment that's why.tell me the real fact behind this.
Where is the singleton class used?
Can you give names of Container classes?
What is the difference between Array and Hash Table?
Explain about abstract classes in java?
Can Applet have constructors?
What are the important features of Java 9 release?
Define the term string pool?
What is jar?
What is the difference between a vector & an array list?
What does it mean that strings are immutable?