Preamble
In Java, the String class perhaps is the most widely used. The Java language API provides a rich set of library to manipulate strings in various ways. Unlike most programming languages in Java, Strings are not character arrays. Rather Java has treated strings as a
class. In Java String references are immutable objects i.e. once initialized the state of the string object does not change or cannot be changed. Every time we initialize a new value, a new String object is created in memory. Due to this flavor of immutability String references can be reused very efficiently. However variable strings are also available in Java. The language offers a separate family of class known as StringBuffer. This is a mutable class. That is, we can change the contents of the StringBuffer object can be changed.
No comments :
Post a Comment