📄 example11_3.java
字号:
/* 创建堆栈 */
import java.util.*;
class Example11_3
{
public static void main(String args[])
{
//构造二个堆栈
Stack mystack1 = new Stack();
Stack mystack2 = new Stack();
// 用push()向堆栈压入数据
for(int i=0; i<10; i++)
{ mystack1.push(i); }
for(int i=10; i<20; i++)
{ mystack2.push(i); }
// 用pop()从堆栈弹出数据
System.out.println("堆栈1: ");
for(int i=0; i<10; i++)
{ System.out.print(" "+mystack1.pop()); }
System.out.println("\n堆栈2: ");
for(int i=0; i<10; i++)
{ System.out.print(" "+mystack2.pop()); }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -