Answer Posted / rakesh soni
Any Program have 'Performance' and 'Memory' issue.
1. If you want to save your 'memory' then use the 'String'
class but 'Performance' will be decrease, because every time
new object create and old object memory collect by Garbage
Collector, so performance decrease.
And
2. If you want 'Performance', than use 'StringBuffer' or
'StringBuilder' object. These class's object consume more
memory but not create new object, so 'Performance' will
increase but with memory overhead.
So take decision according your code and issue. :)
| Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
Can finally block be used without a catch?
What is static block?
What are some examples of variable costs?
Which number is denoted by leading zero in java?
Why does java not allow multiple public classes in a java file ?
what is thread? What are the high-level thread states? Or what are the states associated in the thread? : Java thread
Why do we use string?
Explain creating threads by extending thread class ?
Tell me the latest versions in java related areas?
What is contractor means and methods?
Is there a way to increase the size of an array after its declaration?
What is a vararg?
Why are getters and setters used?
What is the importance of main method in Java?
Can you use abstract and final both with a method?