0
com.sun.jdi.InvocationException调用方法,同时调试
我想实现循环链表和获取异常调试时“发生com.sun.jdi.InvocationException调用方法。”
任何人都可以让我知道为什么我得到这个例外。
public int data;
public Node head;
public CLinkedList() {
super();
}
public void append(int data){
Node n = new Node(data);
if(isEmpty()){
head = n;
n.setNext(head); // Here is the exception, but i am not getting why it is coming.
}
else{
Node temp = head;
while(temp.getNext() != head){
temp = temp.getNext();
}
temp.setNext(n);
n.setNext(head);
}
}
public boolean isEmpty(){
if(null == head){
return true;
}
return false;
}
代码没有问题,我运行它,它工作正常。也许添加Node实现。并添加您正在使用的资源,如com.sun.jdi库 – Adi
请参阅上面更新的图像,谢谢 – user3676578
当我实现它的工作,所以你的发布的代码不是问题,但我实现了我自己的节点类,所以请包括你的Node库路径,也可以尝试自己实现它。 – Adi