NullPointerException in problem 3.3
Opened this issue · 0 comments
damluar commented
When you try to pop, directly after creation, you will get Null Pointer Exception in int v = last.pop()
, since the list of stacks is empty.
public int pop() {
Stack last = getLastStack();
int v = last.pop();
if (last.size == 0) {
stacks.remove(stacks.size() - 1);
}
return v;
}