1).what is the difference between below examples

String s="vijay";

String s=new String("vijay");

Answers were Sorted based on User's Feedback



1).what is the difference between below examples String s="vijay"; String s=new Stri..

Answer / ravikiran

first one will create an object on the heap
second one will create two objects one will saved on the
heap and another will get saved on the string pool

Is This Answer Correct ?    0 Yes 6 No

1).what is the difference between below examples String s="vijay"; String s=new Stri..

Answer / p.sreekiran

in first string class it create in heep memory and second
is created object in constant memeory we cannot change the
second one

Is This Answer Correct ?    2 Yes 13 No

Post New Answer

More Core Java Interview Questions

What is meant by polymorphism?

0 Answers  


What are access specifiers in java ?

0 Answers   Akamai Technologies,


What are the differences between stringbuffer and stringbuilder?

0 Answers  


What does n mean?

0 Answers  


What is keyword auto for?

0 Answers  






How finally used under exception handling?

0 Answers  


Explain method overloading and overriding?

6 Answers  


What are the benefits of operations in java?

0 Answers  


Can we use a switch statement with strings?

0 Answers  


What is an off by one error in java?

0 Answers  


What is lambda in java?

0 Answers  


Write program to print Hello World and print each character address in that string and print how many times each character is in that string? Ex: H: 0 & 1 e:1 & 1 l :2,3,8 & 3 o:4,6 & 2 w:5 & 1 r: 7 & 1 d 9 & 1

7 Answers   Huawei, IBM,


Categories