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...

1).what is the difference between below examples

String s="vijay";

String s=new String("vijay");

Answer Posted / navneet raushan

the first case does: if u write first case , one object and
one refernce will be created. object will be created in
string pool.
But when u write 2nd case , two object and one refernce
will be created , one in string pool and one in heap.

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we force garbage collector to run ?

1000


What is the return type of the main method?

984


What is java full form?

955


How are variables stored?

923


Is java code slower than native code?

1002


Why strings in java are called as immutable?

946


What is a for loop in java?

991


Why hashset is used in java?

1000


Write a program to print 15 random numbers using foreach of java 8?

889


What is a singleton class? Give a practical example of its usage.

1043


What are the types of sockets in java?

1055


Write a program to print count of empty strings in java 8?

937


What are nested classes in java?

1037


What is the purpose of garbage collection in java?

1043


What are the restrictions imposed by a Security Manager on Applets?.

2557