<<< Account Class Java Example | Index | Class Constructors >>> |
public class Stack { // Operations public Stack() { storage = new double[100]; top = 0; } public Stack(int size) { storage = new double[size]; top = 0; } public void clear() { top = 0; } public void push( double dbl) { storage[top++] = dbl; } public double pop() { return storage[--top]; } public boolean full() { return top == storage.length; } public boolean empty() { return ( top == 0 ); } // Data members: private double storage[ ]; private int top; }//class Stack
<<< Account Class Java Example | Index | Class Constructors >>> |