string is immutable? right every one knows that, my
question is it advantage or disadvantage making string
immutable?

Answers were Sorted based on User's Feedback



string is immutable? right every one knows that, my question is it advantage or disadvantage makin..

Answer / payal gupta

It is an advantage that a String class is immutable because
almost all the standard classes use its methods, if they
were mutable, then the behaviour of other standard classes
and their methods would not have been consistent.

Is This Answer Correct ?    7 Yes 7 No

string is immutable? right every one knows that, my question is it advantage or disadvantage makin..

Answer / vinod kumar

It is an advantage
performance: knowing that a string is immutable makes it
easy to lay it out at construction time — fixed and
unchanging storage requirements

Is This Answer Correct ?    3 Yes 3 No

string is immutable? right every one knows that, my question is it advantage or disadvantage makin..

Answer / prashant renge

It is advantage,
because String is standard class,if it is muttable
behaviour is inconsistant.

Is This Answer Correct ?    2 Yes 2 No

string is immutable? right every one knows that, my question is it advantage or disadvantage makin..

Answer / chandu

Sting is Immutable.We can make String as mutable in the give ex
String s="Hello";
String s=s1;
String s2;
s2=s1.append("World");

Is This Answer Correct ?    1 Yes 2 No

string is immutable? right every one knows that, my question is it advantage or disadvantage makin..

Answer / ashish balhara

The performance for String is poor as compared to String
Buffer, as internally (for eg. a simple operation like + on
String), it generates String Buffer, calls append operation
(eqvt. of + in String) & converts result back to String.
Hence extra bytecode is generated which could be done away
with.

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More Core Java Interview Questions

What is meant by call by reference?

0 Answers  


What are the different types of inheritance in java?

0 Answers  


What is methodological theory?

0 Answers  


What is pre increment and post increment in java?

0 Answers  


What is integer parseint?

0 Answers  






how session will be expired ?

4 Answers   Satyam,


Name and explain the types of ways which are used to pass arguments in any function in java.

0 Answers  


i need source code for income tax program using java inheritance

1 Answers  


Can a class have multiple constructors?

0 Answers  


What does the string method compareto () do?

0 Answers  


Is singleton set an interval?

0 Answers  


what is the context

2 Answers  


Categories