APCS Java Subset

Class IllegalStateException

  extended byjava.lang.Throwable
      extended byjava.lang.Exception
          extended byjava.lang.RuntimeException
              extended byap.java.lang.IllegalStateException
All Implemented Interfaces:

public class IllegalStateException
extends java.lang.RuntimeException

Students should understand this error/exception when it occurs in a program.

According to the Java API, an object if this class is thrown when a Java application or the Java environment is not in an appropriate state for some operation or method to be called.

In the AP subset, an IllegalStateException might be thrown if a class invariant isn't satisfied. For example it might be appropriate to throw this exception if a class representing a month in a calendar year is constructed with the integer 15 when only integer values in the range 1-12 represent valid months.

AB students are expected to be able to throw this exception in code they write.

See Also:
Serialized Form

Constructor Summary
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public IllegalStateException()

unofficial documentation for the APCS Java Subset