Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


suppose string s1="rajnish";
string s2="bhaskar";
then what will be happend ?

Answers were Sorted based on User's Feedback



suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

Answer / kvk

two object will be saved in string constant pool

Is This Answer Correct ?    8 Yes 0 No

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

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

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

Answer / ravi jain

2 new string objects will be created in String pool area in JVM.

String are immutable that why they are stores in

different area in JVM

as in case of final variables.

Is This Answer Correct ?    4 Yes 0 No

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

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

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

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

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

Answer / guest

dsf

Is This Answer Correct ?    0 Yes 2 No

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

Answer / selvan

It shows compile error, bcoz without class how it should be
run? so only coming expection. Declaration And all correct.

Is This Answer Correct ?    0 Yes 3 No

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

Answer / ravikiran

two objects will be saved in the heap

Is This Answer Correct ?    0 Yes 6 No

suppose string s1="rajnish"; string s2="bhaskar"; then what will be ha..

Answer / tejas gowda

Two String Object run successfuly and will be saved in the
heap memory

Is This Answer Correct ?    0 Yes 8 No

Post New Answer



More Core Java Interview Questions

Explain about method local inner classes or local inner classes in java?

0 Answers  


What is java used for on a computer?

0 Answers  


Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.

0 Answers   Amdocs,


Can you run the product development on all operating systems ?

1 Answers  


Is main an identifier?

0 Answers  






Is java a super set of javascript?

0 Answers  


What is difference between final and immutable?

0 Answers  


When should I use abstract classes and when should I use interfaces?

2 Answers  


What are inner classes or non static nested classes in java?

0 Answers  


What are heap memory and stack memory and what are memory tables.

0 Answers   Aspiring Minds,


Can we instantiate interface in java?

0 Answers  


What is the difference between DataInputStream and BufferedReader

2 Answers   Hexagon,






Categories