A string is a collection of characters. In Java, strings can be created using three predefined classes namely String, StringBuffer and StringBuilderwhich are available in java.lang package. Why did Java designers provide three classes for creating strings? Each of the above three string classes has their own advantages and disadvantages. If you want to create an immutable (whose content cannot be changed once created) string, String class is the best choice. Strings created using StringBuffer and StringBuilder classes are mutable (content can be changed after they are created). Among StringBuffer and StringBuilder classes, strings created using StringBuffer are thread safe whereas strings
The post How to handle immutable strings in java appeared first on Coding Security.
How to handle immutable strings in java
read more
Tidak ada komentar:
Posting Komentar