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 the use of StringBuffer?

2 Answers   Accenture,


What are the restriction imposed on a static method or a static block of code?

0 Answers  


Can a method be static?

0 Answers  


Can we have any code between try and finally blocks?

0 Answers  


. Differentiate between instance and local variables.

1 Answers  






What is nested interface?

0 Answers  


what do you meant by Runtime Polymorphism?

13 Answers   BVIMR, IBM, Persistent,


What is Java exception handling?

1 Answers  


Explain what is Marker interface?

0 Answers   BirlaSoft,


we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.

0 Answers  


What is the difference between integer parseint and integer valueof?

0 Answers  


relation between list and linked list

1 Answers   Infosys,


Categories