第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

引用 SinglyLinkedList 中的下一個(gè)節(jié)點(diǎn)時(shí)出錯(cuò)

引用 SinglyLinkedList 中的下一個(gè)節(jié)點(diǎn)時(shí)出錯(cuò)

富國(guó)滬深 2023-09-06 16:58:35
我正在研究單鏈表,其中有兩個(gè)類(lèi)singlyLinkedList<E>和Node<E>。當(dāng)我創(chuàng)建Node<E>類(lèi)的對(duì)象時(shí),它在傳遞參數(shù)時(shí)出現(xiàn)錯(cuò)誤main()。這是我的節(jié)點(diǎn)類(lèi):private static class Node<E>{      private E element;      private Node<E> next;      public Node(E e,Node<E> n){       element=e;       next=n;      }      public E getElement(){        return element;      }      public Node<E> getNext(){        return next;      }      public void setNext(Node<E> n){             next=n;      }    }錯(cuò)誤在于: public static void main(String[] args) {        Node<Integer> node1= new Node<>(4,node2);         Node<Integer> node2= new Node<>(4,node3);         Node<Integer> node3= new Node<>(4,node4);         Node<Integer> node4= new Node<>(4,null); }它說(shuō):E擴(kuò)展類(lèi)中聲明的對(duì)象SinglyLinkedList新實(shí)例被忽略筆記:next當(dāng)我將其傳遞給時(shí),它沒(méi)有給出錯(cuò)誤null。
查看完整描述

1 回答

?
夢(mèng)里花落0921

TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超6個(gè)贊

重新排序您的節(jié)點(diǎn)聲明


Node<Integer> node4= new Node<>(4,null);

Node<Integer> node3= new Node<>(4,node4);

Node<Integer> node2= new Node<>(4,node3);

Node<Integer> node1= new Node<>(4,node2);


查看完整回答
反對(duì) 回復(fù) 2023-09-06
  • 1 回答
  • 0 關(guān)注
  • 131 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)