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 / ramaraju

hi

String is a Immutable object,that is
string is an object not a datatype variable.

From the above example

String s=s1 //means it will create a new objet s with the
value raj,not change the value.

Note:whenever u edit or concatinate the string internally
it will create a new object,but not chang that object.

Is This Answer Correct ?    16 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How infinite loop is declared?

541


How do you do math powers in java?

581


What is meant by data hiding in java?

640


Can we serialize singleton class?

537


What exactly is java?

519






Can the interface be final?

583


Define inheritance?

562


How many threads does a core java have?

513


Does java have extension methods?

533


What are data types in oop?

557


What is time complexity algorithm?

548


What is dynamic array in java?

531


Using callable statement how can you pass out parameters, explain with example?

592


What is sizeof () operator?

573


What is a class object?

502