I’m not sure why this isn’t working. Java isn’t giving me an error
I have this in my StateController class

public void insertLinks()
    {
        for(int index=0; //index is a local variable for state objects
                index < numStates;
                index++) 
         //for loop to continue making state objects stopping at numStates(50)
        {
            myList.insertFirst(myStates[index]);
        }
    }

This should work right?

My insertFirst code in my LinkList class is

public void insertFirst(States dd) 
    {                          // if insert at front of list.  NO SEARCH!!
        Link newLink = new Link(dd);   // make new link                                       
        if (isEmpty()) // if empty list,
        {
            last = newLink;                      // Points to end of list
        } else {
            first.previous = newLink;    
            newLink.next = first;           //    Points to next link
        }
        first = newLink;                  //Points to start of Linked List           
    }// end insertFirst()

Exception in thread "main" java.lang.NullPointerException
at project3mitchell.StateController.insertLinks(StateController.java:168)
at project3mitchell.Main.main(Main.java:25)

Those are the errors I am getting

my friend just pointed that out to me and that's exactly what it was. Thank you for your help you were right on the money. I forgot to use LinkList myList = new LinkList(); That's where it screwed up. I forgot the new LinkList(); I tend to forget stupid things like that.

This question has already been answered. Start a new discussion instead.