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 |
hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.
What are the three parts of a simple empty class?
What is the difference between procedural programming and oops?
Why multiple inheritance is not allowed?
What does sksksk mean in text slang?
Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?
How compiler selects(internally) required overridden function in inheritance?
2 Answers CSC, Infinite Computer Solutions,
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
What is the oops and benefits of oops programming?
features of OOPS
22 Answers Ness Technologies, Satyam,
What are the components of marker interface?
What do you mean by binding of data and functions?