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 / paras bist
above program is incorrect ,it will give compile time error
as "Duplicate Variable s1".
it should b
String s1 = "ABC";
String s = s1+"XYZ";
which is valid in string ,as we are creating new String
object
| Is This Answer Correct ? | 14 Yes | 2 No |
Post New Answer View All Answers
what is server side caching?
who can i handle multiple client in RMI
What is the locale class in java programming?
What is a variable analysis?
What is functional interface in java?
What are the classes of java?
What is token in java?
Can an interface implement another interface?
What is pangram in java?
Is main is a keyword?
What is the arraylist in java?
What is the importance of static variable?
What do you mean by singleton class in java?
What is the java project architecture?
What is the difference between multiple processes and multiple threads?