unsafestack.java
来自「实例精华」· Java 代码 · 共 20 行
JAVA
20 行
public class UnsafeStack implements StackInterface
{
private int top = 0;
private int[] values = new int[10];
public void push(int n)
{
values[top] = n; //5
System.out.println("压入数字"+n+"步骤1完成");
top++; //6
System.out.println("压入数字完成");
}
public int[] pop()
{
System.out.print("弹出");
top--; //7
int[] test = {values[top],top}; //8
return test;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?