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
What is meant by JVM? Is JVM platform independent or not?
Explain why wait(), notify() and notifyall() methods are in object class rather than in the reading class?
How to perform bubble sort in java?
What is widening and narrowing in java? Discuss with an example.
What is use of static method?
Why is java so important?
What is concurrent hashmap and its features?
What are the major drawbacks of external iteration?
Why is it called buffering?
How many bytes is a string java?
What is a newline character in java?
Why is the main method declared static?
Does string is thread-safe in java?
Is list thread safe in java?
What is java virtual machine? Explain