package balik; //musi se prelozit do dir. balik import java.io.*; public class Stack_class { //kdyz je public, tak //je v samost. soubor, ten musi mit stejne jmeno private int [ ] stack_ref; private int max_len, top_index; public Stack_class() { //constructor stack_ref = new int [100]; max_len = 99; top_index = -1; } public void push(int number) { if (top_index == max_len) System.out.println("error in push, stack is full"); else stack_ref[++top_index] = number; } public void pop() { if (top_index == -1) System.out.println("error in pop, stack is empty"); else --top_index; } public int top() {return (stack_ref[top_index]);} public boolean empty() {return (top_index == -1);} }