Make a java Stack Interface (LIFO) class. Should use the methods outlines below
ID: 3757962 • Letter: M
Question
Make a java Stack Interface (LIFO) class. Should use the methods outlines below and work with the driver that is provided. If new methods are needed to complete the class than it's ok to add them!
Methods:
• void push( Object )
• Object pop()
• int size()
• String toString()
• boolean isEmpty()
• boolean equals( Object )
Driver:
public class StackDriver {
public static void main( String[] args ) {
Stack a = new Stack();
a.push( 'B' );
a.push( 'a' );
a.push( 't' );
System.out.println( a.toString() );
while( a.isEmpty() == false ) {
System.out.println( a.pop() );
}
}
}
Explanation / Answer
class StackDriver
{
public static void main(String[] args) {