《Java数据结构与算法》笔记-CH4-1栈的实现

class StackX{
	private int maxSize;
	private long[] stackArray;
	private int top;
	public StackX(int size){
		maxSize = size;
		stackArray = new long[maxSize];
		top = -1;//初始化栈顶指针为-1,表示栈中无元素
	}
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("********"+System.getProperty("line.separator"));
		for(int i=0;i

转载于:https://www.cnblogs.com/fstack/p/5617263.html

你可能感兴趣的:(数据结构与算法,java)