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 |
Does c++ support multilevel and multiple inheritance?
What is a class oop?
define oops concept with example
What is the difference between pass by value,pass by pointer,pass by reference in the catch block in the exception handling in c++
What is the use of unnamed namespaces in OOPS? The only advantage I know is that they dont need the scope resolution operator while accessing them. I want to know some other advantages of unnamed namespaces...
namespace is working on which compiler?
What is coupling in oops?
what are three tenets of object orinted Systems?Why they call like that ? Please answer me. Advance thanks.
class type to basic type conversion
You attempt to query the data base with this command: SELECT name, salary FROM employee WHERE salary=(SELECT salary FROM employee WHERE last name='Wagner' OR dept no=233) Choose most appropriate option from the following: 1)Sub-queries are not allowed in the where clause. 2)a multiple row sub-query used with a single row comparison operator. 3)a single row query is used with a multiple row comparison operator.
how to create thread in java?
17 Answers IBM, Infosys, Wipro,
What is the difference between static polymorphism and dynamic polymorphism?