1)What is the difference between String, StringBuilder, and StringBuffer in Java? The main difference is that String is immutable but both StringBuilder and StringBuffer are mutable. Also, StringBuilder is not synchronized like StringBuffer and that’s why a good faster and should be used for temporary String manipulation. 2)Why is String final in Java? The string is final because of same reason it is immutable. A couple of reasons which I think make sense is the implementation of String pool, Security, and Performance. Java designers know that String will be used heavily in every Java program, so they optimized it from
The post Top 10 Most Commonly asked Programming Questions in Java appeared first on Coding Security.
Top 10 Most Commonly asked Programming Questions in Java
read more
Tidak ada komentar:
Posting Komentar