Name

EnumConstantNotPresentException

Synopsis

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.

java.lang.EnumConstantNotPresentException

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( );  
}

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.