Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is pointer in oop?

967


Can we have inheritance without polymorphism?

970


What is difference between pop and oop?

1071


What is property in oops?

988


how to get the oracle certification? send me the answer

2100


class type to basic type conversion

2337


What are properties in oop?

1023


What is static modifier?

1122


What is an advantage of polymorphism?

1029


How is class defined?

1069


Can a destructor be called directly?

1019


What is the use of oops?

993


What is encapsulation selenium?

953


Write a c++ program to display pass and fail for three student using static member function

3323


can inline function declare in private part of class?

4301