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 |
Give two or more real cenario of virtual function and vertual object
Describe what an Interface is and how it?s different from a Class.
what is the difference b/w abstract and interface?
2 Answers Merrill Lynch, Schneider, Scio Healthcare,
what is data abstraction with example.
What is the difference between pass by reference and pass by value?
what is costructor?
Which is not an object oriented programming language?
Why do while loop is used?
What is encapsulation c#?
What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }
can we make a class static without using static keyword?
What is operator overloading? Give Example
11 Answers CTS, IBM, TCS,