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 multithreading and its advantages?

1016


What is finally block?

974


Explain creating threads by extending thread class ?

1008


What is super keyword explain with example?

1202


What is ternary operator in java?

1011


Can you inherit from an abstract class java?

934


Explain different ways of creating a thread. Which one would you prefer and why?

979


What are the types of methodology?

1024


How many ways can we create the string object?

958


Explain the difference between abstraction and encapsulation.

921


What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?

1069


What is :: operator in java?

913


who can i handle multiple client in RMI

1833


How to obtain a performance profile of java program

951


Explain thread life cycle in java?

968