what is difference between
String s=new String("vali");
String s="vali"
Answer Posted / 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 |
Post New Answer View All Answers
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
Why polymorphism is used in oops?
program for insertion ,deletion,sorting in double link list
Can you explain polymorphism?
What is abstraction example?
Which is not an object oriented programming language?
What is the difference between static polymorphism and dynamic polymorphism?
Can we create object of abstract class?
write a program to find 2 power of a 5digit number with out using big int and exponent ?
officer say me - i am offered to a smoking , then what can you say
What is super in oop?
Why it is called runtime polymorphism?
Can we override main method?
Can a destructor be called directly?
Is html an oop?