img
Method
Description
int getLineNumber( )
Returns the source-code line number of the execution point described
by the invoking StackTraceElement. In some situations, the line
number will not be available, in which case a negative value is
returned.
String getMethodName( )
Returns the method name of the execution point described by the
invoking StackTraceElement.
int hashCode( )
Returns the hash code for the invoking StackTraceElement.
boolean isNativeMethod( )
Returns true if the invoking StackTraceElement describes a native
method. Other wise, returns false.
String toString( )
Returns the String equivalent of the invoking sequence.
TABLE 16-20
The Methods Defined by StackTraceElement (continued)
Enum
As described in Chapter 12, enumerations were recently added to the Java language. (Recall that
an enumeration is created by using the keyword enum.) All enumerations automatically inherit
Enum. Enum is a generic class that is declared as shown here:
class Enum<E extends Enum<E>>
Here, E stands for the enumeration type. Enum has no public constructors.
Enum defines several methods that are available for use by all enumerations, which are
shown in Table 16-21.
Method
Description
protected final Object clone( )
Invoking this method causes a
throws CloneNotSuppor tedException
CloneNotSuppor tedException to be thrown. This
prevents enumerations from being cloned.
final int compareTo(E e)
Compares the ordinal value of two constants of the
same enumeration. Returns a negative value if the
invoking constant has an ordinal value less than e's,
zero if the two ordinal values are the same, and a
positive value if the invoking constant has an ordinal
value greater than e's.
final boolean equals(Object obj)
Returns true if obj and the invoking object refer
to the same constant.
final Class<E> getDeclaringClass( )
Returns the type of enumeration of which the
invoking constant is a member.
final int hashCode( )
Returns the hash code for the invoking object.
TABLE 16-21
The Methods Defined by Enum
Search WWH :
Custom Search
Previous Page
Java SE 6 Topic Index
Next Page
Java SE 6 Bookmarks
Home