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
Is a method a procedure?
How do you trim a space in java?
What is a java list?
EDS (Electronic Data Systems India Pvt Ltd) at Chennai on 16-12-2006.
What is string in java is it a data type?
What is data structure in java?
Differences between C and Java?
What’s the difference between unit, integration and functional testing?
What will be the default values of all the elements of an array defined as an instance variable?
How do you read and print a string in java?
how to create multithreaded program? : Java thread
What is the difference between compile-time polymorphism and runtime polymorphism?
What is an argument in java?
What is JDBC Driver interface?How can you retrieve data from the ResultSet
Can a class with private constructor be extended?