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 is the major advantage of external iteration over internal iteration?

1155


What is final keyword in java?

1073


What are the drawbacks of reflection?

1061


How do you call a reference in java?

1039


How does system arraycopy work in java?

1185


What is java virtual machine and how it is considered in context of java’s platform independent feature?

1225


How to store image in arraylist in java?

1029


Compare overloading and overriding?

1061


Which arithmetic operations can result in the throwing of an arithmeticexception?

1065


Does constructor return any value?

1088


What is a type parameter in java?

1064


What is a boolean expression in java?

1077


Can we define private and protected modifiers for variables in interfaces?

1131


How does java enable high performance?

1201


What is the difference between array and array list in java?

1306