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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is diamond operator in java?

503


What is the use of parseint in java?

541


What is a nullable field?

583


What is unicode full form?

559


What is a literal coding?

517






What is flag in java?

537


What will be the default values of all the elements of an array defined as an instance variable?

562


Is it possible for yielded thread to get chance for its execution again ?

555


Why char array is preferred over string for storing password?

592


What are the object and class classes used for?

567


What are the legal operands of the instanceof operator?

569


What is the significance of continue jump statement? Explain with an example.

745


If an object is garbage collected, can it become reachable again?

548


What are user defined exceptions?

593


What are the high-level thread states in java programming?

591