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
Can substring create new object?
Using callable statement how can you pass out parameters, explain with example?
What is a numeric digit?
How can we make sure main() is the last thread to finish in java program?
What are the basics of core java?
What is a boolean structure?
What are the differences between wait() and sleep()?
Is void a data type in java?
What is unsigned char?
What is an iterator interface in java programming?
What is called module?
What is the purpose of stub and skeleton?
What is meant by distributed application? Why are we using that in our application?
What is the difference between equals() and?
what are different ways in which a thread can enter the waiting state? : Java thread