String is a immutable objects . it means that string does
not change...........
But it will be chang.........
{
String s="kapil";
String s1="raj";
String s=s1;
then print(.......)
The String has been changed ..
how it is possible and why its called immutable objects

Answer Posted / gohil

Anil Kumar Khichar is wrong there is no issue in assigning
s1 to s.

In case if you do so. Only a referenced is copied to s.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different ways of implementing thread? Which one is more advantageous?

538


Why we do exception handling in java and how many types of exceptions are there?

547


Explain the difference between protected and default access.

513


Why collection is called framework in java?

540


How to change the priority of thread or how to set the priority of thread?

615






Explain wrapper classes in java?

530


What is locale in java?

575


What are the approaches that you will follow for making a program very efficient?

650


What is the difference between double and float variables in java?

636


What is a container in a gui?

548


Define an applet in java?

629


Can you make a constructor final in Java?

628


What are the types of inner classes (non-static nested class) used in java?

564


What is mvc in java?

558


What is core java called?

524