alguem sabe me dizer o q esta errado no meu codigo??/
public class pilha {
private Node top;
public pilha(){
top = null;
size = 0;
}
public int size(){
return size;
}
public boolean isEmpty(){
if (top==null)
return true;
return false;
}
public void push(Object elem){
Node n = new Node();
//cria um novo nó
n.setElement(elem);
n.setNext(top);
//liga o novo nó
top = n;size++;
}
public Object top() throws RuntimeException{
if (isEmpty())throw new RuntimeException("Pilha está vazia.");
return top.getElement();
}
}