myStringList.insertLast(name)
別のものに変更する必要があるかどうかわからないという問題があり.insertLast
ます。エラーは、名前を変数に解決できないことを示しています。
public class TestLinkedList
{
public static void main(String [] args)
{
// define an Integer linked list MyIntList
LinkedListClass<Integer> MyIntegerList = new LinkedListClass<Integer>();
// intitialize the list
MyIntegerList.initializeList();
// insert a last element 5, then 6, and 7
MyIntegerList.insertLast(5);
MyIntegerList.insertLast(6);
MyIntegerList.insertLast(7);
// print the list
MyIntegerList.print();
// insert first element 8
MyIntegerList.insertFirst(11);
// print the list
MyIntegerList.print();
// define a String linked list MyStringList
LinkedListClass<String> MyStringList = new LinkedListClass<String>();
// initialize the list
MyStringList.initializeList();
// insert last element Chris ,then Tom, and Bo
MyStringList.insertLast(Chris);
MyStringList.insertLast(Tom);
MyStringList.insertLast(Bo);
// print the list
MyStringList.print();
// insert first element Bo
MyStringList.insertFirst(Anna);
// print the list
MyStringList.print();
}
}
私が受け取った実際のエラーは次のように言っています:
4 errors found:
File: C:\Users\GreatOne\Desktop\Master Folder\LinkedList\LinkedList\TestLinkedList.java [line: 36]
Error: Chris cannot be resolved to a variable
File: C:\Users\GreatOne\Desktop\Master Folder\LinkedList\LinkedList\TestLinkedList.java [line: 37]
Error: Tom cannot be resolved to a variable
File: C:\Users\GreatOne\Desktop\Master Folder\LinkedList\LinkedList\TestLinkedList.java [line: 38]
Error: Bo cannot be resolved to a variable
File: C:\Users\GreatOne\Desktop\Master Folder\LinkedList\LinkedList\TestLinkedList.java [line: 44]
Error: Bo cannot be resolved to a variable