what is difference between
String s=new String("vali");
String s="vali"
Answer Posted / kartik sharma
In case of String s=new String("vali"); , a memory in the heap is allocated to the variable of the class String, and then the value is given to the variable s="vali". Using new operator , we can allocate the memory to the instance of the class.
But in String s="vali" , only the variable s is given the value as vali but there is no permanent memory given to the variable in heap.
Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
What does no cap mean?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What are the data types in oop?
Prepare me a program for the animation of train
c++ program to swap the objects of two different classes
How does polymorphism work?
What is encapsulation in ict?
What are the important components of cohesion?
I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...
What is constructor in oop?
What does and I oop and sksksk mean?
Get me a number puzzle game-program
What polymorphism means?
What is polymorphism give a real life example?
what is the drawback of classical methods in oops?