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 advantage of java?
List down the methods and interfaces of collection class in java.
What is an infinite loop?
Why arraylist is not synchronized in java example?
Write a program to print all permutations of string?
Explain what access modifiers can be used for variables?
How do you generate random numbers in java?
What is set string?
How does a for loop work java?
What are void pointers?
What is the purpose of garbage collection in java? When is it used?
What is lambda programming?
Write a program to solve producer consumer problem in java?
Does substring create a new object?
What is the format specifier?