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
What is diamond operator in java?
What is the use of parseint in java?
What is a nullable field?
What is unicode full form?
What is a literal coding?
What is flag in java?
What will be the default values of all the elements of an array defined as an instance variable?
Is it possible for yielded thread to get chance for its execution again ?
Why char array is preferred over string for storing password?
What are the object and class classes used for?
What are the legal operands of the instanceof operator?
What is the significance of continue jump statement? Explain with an example.
If an object is garbage collected, can it become reachable again?
What are user defined exceptions?
What are the high-level thread states in java programming?