EmptyStackException

  • EmptyStackException signals that a Stack is empty when a method is called on it.

  • It's a type of RuntimeException, meaning it's typically thrown during program execution due to programming errors.

  • This exception has a single constructor that takes no arguments and sets the error message to null.

  • It inherits methods from the Throwable class that offer details like the stack trace and error message.

  • EmptyStackException is related to the Stack class which is used for last-in, first-out (LIFO) data structures.

public class EmptyStackException extends RuntimeException

Thrown by methods in the Stack class to indicate that the stack is empty.

See Also

Public Constructor Summary

EmptyStackException()
Constructs a new EmptyStackException with null as its error message string.

Inherited Method Summary

Public Constructors

public EmptyStackException ()

Constructs a new EmptyStackException with null as its error message string.