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

Compilation ERROR
Duplicate Variable s1.

Is This Answer Correct ?    2 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I get 64 bit java?

714


What are basic keywords?

791


What is identifier in java?

779


How do you ensure that n threads can access n resources without deadlock?

1079


How are observer and observable used in java programming?

754


What is the static import?

824


What is stringwriter?

737


What is public static void main?

791


Highest level event class of the event-delegation model?

3705


What are some alternatives to inheritance?

818


If try block is successfully executed, Then Is Finally block executed?

826


Does a function need a return?

739


Which oo concept is achieved by using overloading and overriding?

753


What are inbuilt functions?

746


What is the old name of java?

711