Class EmptyStackException in Java

digitization, transformation, binary

Class EmptyStackException in Java

EmptyStackException is thrown by the Stack class to indicate that the stack is empty and there is no element present to pop out from the stack.

The hierarchy of EmptyStackException

Class EmptyStackException in Java
Class EmptyStackException in Java
  • lang.Object
  • —lang.Throwable
  • ——lang.Exception
  •  ———lang.RuntimeException
  • ————–util.EmptyStackException

The structure of EmptyStackException is given by

public class java.util.EmptyStackException extends java.lang.RuntimeExceprion{
//constructor
public EmptyStackException();
//constructs a new EmptyStackException with no details message.
} 

The class EmptyStackException also inherits methods from class Object and Throwable.

Ads code goes here
From Object classFrom Throwable class
clone()fillInStackTrace()
getClass()getMessage()
notify()printStackTrace()
wait()printStackTrace(PrintWriter)
wait(long, int)getLocalizedMessage()
wait(long)printStackTrace(PrintStream)
equals(Object)addSuppressed()
finalize()getCause()
hashCode()getStackTrace()
notifyAll()getSuppressed()
initCause()
setStackTrace()
toString()

Share and Enjoy !

READ  Class StringCharacterIterator in Java

Leave a Comment

Your email address will not be published. Required fields are marked *