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 / sivadasan

It will Give Compile time Error...

We can not declare again s1.

So the Compiler will give

s1 is already defined in main(java.lang.String[])

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is substring in java?

1230


Which is easier .net or java?

1089


How many bits are in a sentence?

1178


What is a parameter in a function?

1000


What is loop in java?

995


Justify your answer that you can't define a method inside another method in java, if you can then how?

1182


What is __ init __ functions?

1129


Define array. Tell me about 2-D array.

1056


What is a jit compiler?

1136


What are the advantages of user defined functions?

1007


How do you escape sequences in java?

1075


Is final static java?

1018


Give example to differentiate between call by value and call by reference.

1064


what is singleton class in java?

1058


What do you mean by compiler?

1048