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

Explain the difference between call by refrence and call by value?

557


What are wrapped classes in java programming?

582


Define max and min heap, also the search time of heap.

586


When the constructor of a class is invoked?

587


How many boolean functions are there?

502






What are methods and how are they defined?

601


Is this valid in java ? Can we instantiate interface in java?

544


What is the size of boolean variable?

568


What is the return type of the main method?

574


What are the different types of java?

554


Explain illegalmonitorstateexception and when it will be thrown?

617


What is a dynamic array in java?

563


What are the main differences between the java platform and other platforms?

526


Write a program to print all permutations of string?

673


What is the purpose of lambda expressions?

584