final String name( )
Returns the unaltered name of the invoking constant.
final int ordinal( )
Returns a value that indicates an enumeration
constant's position in the list of constants.
String toString( )
Returns the name of the invoking constant. This
name may dif fer from the one used in the
enumeration's declaration.
Returns the constant associated with name in the
static <T extends Enum<T>> T
valueOf(Class<T> e-type, String name)
enumeration type specified by e-type.
TABLE 16-21
The Methods Defined by Enum (continued)
The CharSequence Interface
The CharSequence interface defines methods that grant read-only access to a sequence of
characters. These methods are shown in Table 16-22. This interface is implemented by String,
StringBuffer, and StringBuilder. It is also implemented by CharBuffer, which is in the
java.nio package (described later in this topic).
The Comparable Interface
Objects of classes that implement Comparable can be ordered. In other words, classes that
implement Comparable contain objects that can be compared in some meaningful manner.
Comparable is generic and is declared like this:
interface Comparable<T>
Here, T represents the type of objects being compared.
The Comparable interface declares one method that is used to determine what Java
calls the natural ordering of instances of a class. The signature of the method is shown here:
int compareTo(T obj)
char charAt(int idx)
Returns the character at the index specified by idx.
int length( )
Returns the number of characters in the invoking
Returns a subset of the invoking sequence beginning at
subSequence(int star tIdx, int stopIdx) star tIdx and ending at stopIdx­1.
String toString( )
Returns the String equivalent of the invoking sequence.
TABLE 16-22
The Methods Defined by CharSequence
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks