📄 seqstackapp.java
字号:
package seqStack;
import seqStack.SeqStack.FullStackException;
public class SeqStackApp
{
public static void main(String[] args)
{
System.out.println("SeqStack Demo");
System.out.println("-------------");
seqStackApp(new SeqStack(4));
}
static void seqStackApp(Stack s)
{
System.out.println("Pushing \"Hello\"");
s.push("Hello");
System.out.println("Pushing \" World\"");
s.push("World");
System.out.println("Pushing SeqStackApp Object");
s.push(new SeqStackApp());
System.out.println("Pushing Character object");
s.push("A");
System.out.println();
try
{
System.out.println("Pushing \"One last item\"");
s.push("One last item");
}catch(FullStackException e){System.out.println ("One push too many");}
System.out.println(s.getTop());
while(s.notEmpty()) System.out.println(s.pop());
try{s.pop();}catch(java.util.EmptyStackException e){System.out.println("Stack is empty!"); };
System.out.println();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -