I create a UnorderedLinkedList to split my sublist

public class UnorderedLinkedList<E extends Comparable<? super E>> extends LinkedList<E>
    {
         public void splitMid(LinkedList<E> subList)
    {


        Node<T> current;//the head pointer
        Node<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
        {

            head = null;
            current = head.next;
            i = 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;

        }

    }
And when I compile it gave the error message that
G:\LinkedList\src\LinkedList.java:184: error: cannot find symbol
            subList.count = 0;
  symbol:   variable count
  location: variable subList of type LinkedList<E>.Node<T>
  where T,E are type-variables:
  T extends Object declared in class LinkedList
  E extends Comparable<? super E> declared in class LinkedList.UnorderedLinkedList
In 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);

        JOptionPane optionPane = new JOptionPane();
        String str1 = optionPane.showInputDialog(null, "show orignal LinkedList:" + myList);   
        myList.splitMid( subList);
        String str2 = optionPane.showInputDialog(null, "show myList after calling splitMid:" + myList); 
        String str3 = optionPane.showInputDialog(null, "subList is:" + subList); 

it gaves a error:

G:\LinkedList\src\LinkedTest.java:31: error: cannot find symbol
        myList.splitMid( subList);
  symbol:   method splitMid(LinkedList<Integer>)
  location: variable myList of type LinkedList<Integer>

well, you don't have a variable count (as the error message states) and you are using the original LinkedList type, not the type you created, and that type doesn't have a 'splitMid' method.

the error messages pretty much tell you what the problem is, what exactly is your question?

So do i need rename my method? actualy as my teacher require, i need to use the public void splitMid(LinkedListClass sublist) so i change like this?

 public class UnorderedLinkedList<E extends Comparable<? super E>> extends LinkedList<E>
    {
         public void splitMid(LinkedListClass subList)
    {


        LinkedListClass<T> current;//the head pointer
        LinkedListClass<T> mid;//the mid point 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.