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 is the use of singleton?

518


What is bean? Where it can be used?

611


Is {a, n, d} a palindrome? If you are given a random string, is it a palindrome or not?

625


What are different types of arrays?

539


What happens when you invoke a thread’s interrupt method while it is sleeping or waiting?

580






What is jrmp?

552


What is the purpose class.forname method?

564


What is a jit compiler?

640


can rmi and corba based applications interact ?

674


What is a java string?

549


What is module with example?

516


What is java command?

574


Why is java architectural neutral?

619


How many types of classes are there in java?

525


What does file separator do in java?

543