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

when you put String s = new String(null)
you will get the thing waht i'm trying to say that
beacuse my english is weak so what i'm trying to say
understatd
beacuse there is no realtion between the
1)which is for literal
2)which is for new String()
don't add both at the same time
because both are different question itself and different
answer itself.
but you will connect that then the problem is your own so
please
if you try to add both the thing is comeup
throug the itself that the hello string in a pool for the
first statement
so for the second String s = new String("hello");
compiler go to the pool and and check that "hello" it is
present if it present then it will pick it through the pool
and assign it to the overloaaded constructor of the String
class which will take the String(string s)so new operator
creates new object which will contain the hello.
and the the new String object will create so please check
to put String s = new String(null)
you will get ambiguous error
overloaded constructor in String class
String(String s) and String(StringBuffer s) and many
and you will get what i'm trying to say so do't add
ist STATEMENT TO SECOND WHICH IS FOR NEW STRING()
thanks
amitsing2008@gmail.com

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can extern variables be initialized?

893


What is int argc char * argv?

1061


What is the exact difference in between Unicast and Multicast object?

2042


What is a local class in java?

988


Why java is a platform independent? Explain

1005


When parseint method can be used?

891


What is the difference between abstract class and interface1? What is an interface?

997


What is proper subset?

917


What is the difference between JDK and JVM?

1180


Does garbage collection occur in permanent generation space in jvm?

1022


What is core java called?

920


What is Session reduplication and how its done?

1981


When throw keyword is used?

991


How many types of gc are there in java?

931


Explain the access modifiers for a class, method and variables?

1091