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 method overriding?

1075


What is the benefit of inner classes in java?

1062


How will you invoke any external process in java?

1097


Can you inherit a constructor java?

1055


What is the java idl system?

1033


Can an interface extend another interface?

1042


Can a class declared as private be accessed outside it’s package?

999


Is java developer a good career?

1002


Differentiate between nested and inner class in java.

983


What is the purpose of java?

993


Is arraylist zero based?

1042


What is the static field modifier?

1105


How do you use compareto?

926


What is the use of arraylist in java?

1071


What is the difference between preemptive scheduling and time slicing in java programming?

999