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 do you understand by synchronization?

1050


What is the difference between variable & constant?

1027


Can a main method be declared final?

1056


What is the flag in java?

1061


Which is bigger float or double java?

978


Can a method inside a interface be declared as final?

1005


Which category the java thread do fall in?

999


What is the difference between @before and @beforeclass annotation?

1106


What are the two types of java?

1174


Explain different types of wrapper classes in java?

1024


What are three advantages of using functions?

1010


What is the use of conditional statement?

985


What sorting algorithm does javascript use?

984


What do you mean by platform independence of Java?

1156


Can a top level class be private or protected?

1053