Hi ,I am trying to implement stack with linked list ,but when I run it show up
NullPointerException
How can I avoid that with try and catch
Thanks
public char pop() {
try{
ListNode returnNode = top;
top = top.next;
} catch (Exception e){}
return returnNode.value;
}