gistfile1.txt package com.trs.exercise;public class Stack {private String[] stackArray;private int top;private int size;/** * * @param stackSize */Stack(int stackSize) {top = -1;stackArray = new String[stackSize];size = stackSize;}/** * * @
package com.trs.exercise; public class Stack { private String[] stackArray; private int top; private int size; /** * * @param stackSize */ Stack(int stackSize) { top = -1; stackArray = new String[stackSize]; size = stackSize; } /** * * @param input * @return */ boolean push(String input) { if (top <= size - 2) { stackArray[++top] = input; return true; } else { return false; } } /** * * @return */ String pop() { return stackArray[top--]; } /** * * @return */ String peek() { return stackArray[top]; } /** * * @return */ boolean isEmpty() { if (top == -1) return true; else return false; } void print() { for (int i = 0; i < top + 1; i++) { System.out.println(stackArray[i]); } } }