Home » How to Optimize Java String Creation

How to Optimize Java String Creation

by Online Tutorials Library

How to optimize string creation?

By using string literals.

Ex:

File: StringPerformance .java

Output:

Time taken to create literal String : 9 ms  Time taken to create Object String : 11 ms  

Hence, String creation using literals take less time.

Next TopicJava String FAQs

You may also like