📄 safestack.java
字号:
public class SafeStack implements StackInterface{
private int top = 0;
private int[] values = new int[10];
public void push(int n) {
synchronized(this)
{
values[top] = n;
System.out.println("压入数字"+n+"步骤1完成");
top++;
System.out.println("压入数字完成");
}
}
public int[] pop() {
synchronized(this)
{
System.out.print("弹出");
top--;
int[] test = {values[top],top};
return test;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -