Stack ADT using Arrays

Aim: 
To write a java program that implements stack ADT using an array.

Description: 
Create an interface StackADT with a constant size and declare methodprototypes push (), pop (), traverse () in that interface. By writing a class implements those method bodies. Declare a variable top which is initialized with -1 for every push operation the top is incremented by 1 and an element of type int is stored into an arry stack (i.e stk[]). For every pop operation the top is decremented by 1. For traverse operation the elements are displayed starting from stk[top] to stk[0].

Program:
import java.io.*;
interface StackADT
{
int SIZE = 10;
void push(int elem);
void pop();
void traverse();
}
class MyClass implements StackADT
{
int top = -1;
int stk[];
MyClass()
{
stk = new int[SIZE];
}
public void push(int elem)
{
if ( top == (SIZE-1) )
System.out.println("Stack is full");
else
{ top++;
stk[top] = elem;
}
}
public void pop()
{
if ( top == -1)
System.out.println("Stack is empty, no element to delete");
else
{ System.out.println("The deleted element is : " + stk[top]);
top--;
}
}
public void traverse()
{ if ( top == -1)
System.out.println("Stack is empty, no elements to traverse");
else
{ System.out.println("Elements in the stack are : ");
for(int i= top; i>= 0 ; i--)
System.out.println(stk[i]);
}
}
}
class StackDemo
{ public static void main(String args[]) throws IOException
{
BufferedReader br = new BufferedReader( new InputStreamReader(
System.in));
MyClass ob = new MyClass();
int ch, elem;
do
{
System.out.println("1.Push");
System.out.println("2.Pop");
System.out.println("3.Traverse");
System.out.println("4.Exit");
System.out.println("Enter your choice : ");
ch = Integer.parseInt(br.readLine());
switch( ch )
{
case 1 : System.out.println("Enter element to insert :");
elem = Integer.parseInt( br.readLine() );
ob.push(elem);
break;
case 2: ob.pop();
break;
case 3: ob.traverse();
break;
case 4: System.exit(0);
}
}while( ch>0 && ch< 5);
}
}