Java in a Nutshell, 5th Edition [Electronic resources]

نسخه متنی -صفحه : 1191/ 215
نمايش فراداده

EnumConstantNotPresentExceptionjava.lang

Java 5.0serializable unchecked

This unchecked exception is thrown when Java code attempts to use an enum constant that no longer exists. This can happen only if the enumerated constant was removed from its enumerated type after the referencing code was compiled. The methods of the exception provide the Class of the enumerated type and the name of the nonexistent constant.

Figure 10-19. java.lang.EnumConstantNotPresentException

public class

EnumConstantNotPresentException extends RuntimeException { // Public Constructors public

EnumConstantNotPresentException (Class<? extends Enum>

enumType , String

constantName ); // Public Instance Methods public String

constantName ( ); public Class<? extends Enum>

enumType ( ); }