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
What is substring in java?
Which is easier .net or java?
How many bits are in a sentence?
What is a parameter in a function?
What is loop in java?
Justify your answer that you can't define a method inside another method in java, if you can then how?
What is __ init __ functions?
Define array. Tell me about 2-D array.
What is a jit compiler?
What are the advantages of user defined functions?
How do you escape sequences in java?
Is final static java?
Give example to differentiate between call by value and call by reference.
what is singleton class in java?
What do you mean by compiler?