But in Java, string is an object that represents a sequence of characters. Generally, String is a sequence of characters. Let's first understand what String in Java is and how to create the String object. For mutable strings, you can use StringBuffer and StringBuilder classes. Whenever we change any string, a new instance is created. The Java String is immutable which means it cannot be changed. It means, we can create strings in Java by using these three classes. String, StringBuffer and StringBuilder classes implement it. The CharSequence interface is used to represent the sequence of characters. The class implements Serializable, Comparable and CharSequence interfaces. Java String class provides a lot of methods to perform operations on strings such as compare(), concat(), equals(), split(), length(), replace(), compareTo(), intern(), substring() etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |