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