我正在研究來自加州大學伯克利分校的this視頻的鏈接列表。然而,當我嘗試在我的Eclipse編譯器輸入相同的版本,像這樣的....Java - 變量聲明ID預期在此令牌之後,將值分配給實例變量時
public class CreateLinkedList{
public class Node{
String PlayerName;
Node next;
}
Node first = new Node();
Node second = new Node();
Node third = new Node();
first.PlayerName = "Sanchez";
second.PlayerName = "Ozil";
third.PlayerName = "Welbeck";
public static void main(String[] args) {
}
}
我得到的錯誤PlayerName「令牌語法錯誤‘’,此令牌後VariableDeclaratorID預期」以下線
first.PlayerName = "Sanchez";
second.PlayerName = "Ozil";
third.PlayerName = "Welbeck";
任何人都可以解釋我要去哪裏錯了嗎?
你在問或說明嗎? – 2014-10-03 02:55:30
陳述@SotiriosDelimanolis :) – Satya 2014-10-03 02:56:45