1).what is the difference between below examples
String s="vijay";
String s=new String("vijay");
Answer Posted / navneet raushan
the first case does: if u write first case , one object and
one refernce will be created. object will be created in
string pool.
But when u write 2nd case , two object and one refernce
will be created , one in string pool and one in heap.
Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
What are the different http methods?
What is the purpose of abstract class?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? : Java thread
What is a private class in java?
What is the purpose of the enableevents() method?
What is the difference between the font and fontmetrics classes in java programming?
List some important features of java 10 release?
What are white spaces in java?
What is immutable state?
Is there a sort function in java?
What is private static in java?
What is a text string?
How do I know if java is installed?
What is the purpose of the strictfp keyword?
Is empty string in java?