what is difference between
String s=new String("vali");
String s="vali"
Answer / 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 |
What is an example of genetic polymorphism?
i ahve v low % in 12th n BSC which is aroun 50 coz science was imposed on me......nw m doin MCA n my aggregate in above 74%,what shud i say if asked about low previous percentage??????
how do you handle yourself when you feel the wald is aganist you
how to write a java program for an output ****0 ***01 **012 *0123 01234
why function overloading is not called as pure polymorphism?
what are the realtime excercises in C++?
Is oop better than procedural?
write a c++ program to find maximum of two numbers using inline functions.
What is coupling in oops?
Why a "operator=(...)" when there is a copy ctor?
what are the characteristics of oops?
What is abstraction oop?