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

為了賬號安全,請及時綁定郵箱和手機立即綁定

有好心人幫我解釋一下每行代碼的含義嗎,謝謝!

class Element

{

? ? public int value;

? ? public Element next;

}



public class Program {

public static void main(String[] args) {

Element start=new Element();

start.value=22;?

Element end=start;

Element temp=start;

end.next=null;

temp=new Element();

temp.value=45;

end.next=temp;

end=end.next;

end.next=null;

//printing, simple way

? ? ? ? System.out.println(start.value);

? ? ? ? System.out.println(start.next.value);

? ? ? ??

? ? ? //printing, universal way

? ? ? ? for (temp = start; temp != null; temp = temp.next) {

? ? ? ? ? ? System.out.println(temp.value);

? ? ? ? }


}


}


正在回答

1 回答

class Element ?? //創(chuàng)建一個類

{

? ? public int value; ? // 定義成員變量

? ? public Element next;? //定義成員變量

}



public class Program { ? // 創(chuàng)建一個program類

public static void main(String[] args) { ? //main函數(shù)

Element start=new Element(); ?? // 創(chuàng)建一個start的對象

start.value=22; ? //定義value的值

Element end=start; ? ?? // 創(chuàng)建element的對象?

Element temp=start;? //同上

end.next=null; ? // 給next賦值為null,既為空

temp=new Element();// 實例化一個對象

temp.value=45;? // 賦值

end.next=temp; //同上

end=end.next;//同上

end.next=null;//同上

//printing, simple way

? ? ? ? System.out.println(start.value); ? ? //輸出語句

? ? ? ? System.out.println(start.next.value); //輸出

? ? ? ??

? ? ? //printing, universal way

? ? ? ? for (temp = start; temp != null; temp = temp.next) {//遍歷數(shù)組

? ? ? ? ? ? System.out.println(temp.value);// 輸出

? ? ? ? }


}


}


2 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

有好心人幫我解釋一下每行代碼的含義嗎,謝謝!

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

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