It is the only abstract interface in the java.lang package. It is the basic interface containing non-implemented methods all regarding and involving characters only like length() , charAt() etc and a special method i.e toString() method. It is the super class of many of the classes and interfaces, which are shown below.
Implementation class for the abstract method declared in the in the CharSequence interface are:-
AbstractStringBuilder (c) of [ java.lang package ]
String (c) of [ java.lang package ]
StringBuffer (c) of [ java.lang package ]
StringBuilder (c) of [ java.lang package ]
CharBuffer (c) of [ java.nio package ]
Segment (c) of [ javax.swing.text package ]
Note : (c) represent the class. All the above mentioned names are java class.
Methods of the CharSequence interface :
public abstract int length();
public abstract char charAt(int i);
public abstract CharSequence subSequence(int i, int j);
public abstract String toString();
Some of the important points of CharSequence interface :
* It was first introduced with the release of JDK 1.4.
* CharSequence is originally is the sequence of character and which combines to form a String only,
so we can call a string as the CharSequence.
ReplyDeletenice article for beginners.thank you.
java tutorial
java tutorial