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

String is an immutable object.
Then how can the following code be justified.

String s1 = ?ABC?;
String s1 = s1+?XYZ?;
s.o.p(s1);

The output is ABCXYZ, which is the value of s1 ?

Answer Posted / vishal

in the later case a different overloaded contructor is
invoked while in the prior case a different.As in the later
case a different constructor initializes the string s1 with
different values hence the result

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what do you mean by classloader?

1038


Is integer a class?

1025


What is the implementation of destroy method in java. Is it native or java code?

914


What are different types of states exist for a thread?

974


What are the 3 types of control structures?

972


Why isn’t there operator overloading?

1027


What is the major advantage of external iteration over internal iteration?

1047


How do you sort arraylist in descending order?

991


Is .net better than java?

974


What is java util list?

891


Can you start a thread twice in Java?

1075


Is class forname reflection?

925


What is application tier?

1067


Is java 11 paid version?

932


Explain super keyword in java.

1003