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 the difference between String s="hello"; and String
s=new String("hello");?

Answer Posted / amit singh

not the difference both are the string
String s = "hello"
its aliteral string it will be in a pool
imagine that when you cretae the anothre string
String s1 = "hello"
thn ther is not new Styrin object wil cretae its will pick
from the pool where the literal strin g hello will presnet
so s>
----------"hello"

s1>
both pointing the same string
2)String s = new String("hello");
there are two string will create frist the litreal "hello"
then the other through the new String("hello"); which is
point through referenece s is pointed so there is always
create a new String which is pointed by the reference s
its not going to pick through the pool
amitsing2008@gmail.com
amit09mca(scjp 1.5 and manymore)

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What will happen if a thrown exception is not handled?

955


What does this () mean in java?

934


what is a working thread? : Java thread

995


What are multiple inheritances? Is it supported by java?

891


What do you mean by Function Overloading in java?

1128


How many JVMs can run on a single machine and what is the meaning of Just-In-Time (JIT) compiler?

1341


What is the technique adopted to create an immutable class?

1038


What is final variable?

882


Is vector synchronized in java?

939


How do you use compareto in java?

928


What are the fileinputstream and fileoutputstream?

1021


What are the application of stack?

863


What is JDBC Driver interface?How can you retrieve data from the ResultSet

2048


Why do we need wrapper class?

943


What is a Hash Table? What are the advantages of using a hash table?

1038