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

Can we create object of abstract class?

1081


What is the types of inheritance?

1090


What is encapsulation with example?

1092


How do you use inheritance in unity?

1071


What is an advantage of polymorphism?

1091


What is pure oop?

1095


to find out the minimum of two integer number of two different classes using friend function

2122


What makes a language oop?

1048


What is object in oops?

1053


What is abstract class in oops?

1022


• What are the desirable attributes for memory managment?

2225


What is the difference between procedural programming and oops?

1120


What are the 3 pillars of oop?

1186


What is coupling in oops?

1138


What is oops concept with example?

1011