[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/mihinduranasinghe/Java-Programs/master/StackUsingArray.java [Back]  [Original]

public class StackUsingArray {

    int size = 5;
    int top = -1;
    int[] a = new int[size];

    boolean isEmpty(){
        return (top=(size-1)){
            System.out.println("Stack Overflow");
        }
        else{
            top += 1;
            a[top] = x;
            System.out.println(x + " pushed into stack");
        }
    }

    int pop(){
        if(top

Web Proxy Viewer  |  New URL  |  Original Page