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 |
How many types of access specifier in c# and vb.net?
what is the use of template classes in c++
Why is oop useful?
Program to read a comment string
what is data hiding.
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.
What do you mean by inheritance?
what is namespace? what are the uses of namespace?
JAVA is FULLY OBJECT ORIENTED PROGRAMING LANGUAGE?
Why and when is a virtual destructor needed?
How is data security provided in Object Oriented languages? ?
How is class defined?