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
State the significance of public, private, protected class?
What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?
What is the main difference between java platform and other platforms?
Write an algorithm program in java for the following question.. In a VLSI design techniques,they used rectangles to design circuits. EVery rectangle is to be placed according to x,y coordinates. Check whether or not two rectangles overlap each other. Here overlapping of rectangles is acceptable, if 1) one rectangle intersect with other. 2) one rectangle fully covers other. The time of algorithm should not exceed o(n logn).
Is java a compiler?
Can a class have 2 constructors?
Write a function to find out longest palindrome in a given string?
What do you mean by singleton class in java?
What is the indent key?
Can list contain null in java?
What is the functionability stubs and skeletons?
What is pojo class in java?
Why constructor has no return type?
What is 32 bit float?
Why is the main method declared static?