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 are the three parts of a simple empty class?
i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????
143.what is oops principles?
Which language is pure oop?
What is the point of polymorphism?
What is a mixin class?
When you define a integer it gets stored in which data structure?(Stack or a heap)
What is a macro? And how is a macro same as a template?
How to calculate the age from the date of birth by using the program?
What is abstract class in oops?
what is an qt4 interface?
Example for 4 pillar of oops like, Inheritance,Poly,Abstraction,Encabsulation ?