Java split list -


i have assignment create linked list , split 2 sublist , right have error code. if 1 can me code, can't figure out needs change every since change gave me more error.

public class unorderedlinkedlist<e extends comparable<? super e>> extends linkedlist<t> {     public void splitmid(linkedlist<string> sublist)     {         linkedlist<t> current;//the head pointer         linkedlist<t> mid;//the mid point           //node first = firstnode;         //node last = firstnode;          //node sublistfirst;         //node sublistlast;         int i;          if(head == null)         {             sublist.head = null;             sublist.last = null;             sublist.count = 0;         }         else         {             //mid =             head = null;             current = head.next;             = 1;              if(current != null)                 current = current.next;              while(current != null)             {                 mid = mid.next;                 current = current.next;                 i++;                  if(current != null)                     current = current.next;             }               sublist.head = head.next;              sublist.last = last;              last = mid ;              last.next = null;               sublist.count = count - i;              count = i;         }     } } 

error message

g:\linkedlist\src\linkedlist.java:184: error: cannot find symbol sublist.count = 0;

symbol: variable count.

location: variable sublist of type linkedlist.node

where t,e type-variables:

t extends object declared in class linkedlist.

e extends comparable declared in class linkedlist.unorderedlinkedlist

my main class:

public void main(string args[]) {     linkedlist<integer> mylist = new linkedlist<integer>();     linkedlist<integer> sublist = new linkedlist<integer>();      mylist.addlast(34);     mylist.addlast(65);     mylist.addlast(87);     mylist.addlast(29);     mylist.addlast(12);      mylist.splitmid( sublist); } 

error message

g:\linkedlist\src\linkedtest.java:31: error: cannot find symbol.

mylist.splitmid(sublist);

symbol: method splitmid(linkedlist)

location: variable mylist of type linkedlist

about compilation error:

you using instance of linkedlist call method have defined class unorderedlinkedlist


Comments