Binary Search Tree implementation not giving right values
<p>Im trying to make a BST take a DataType, of my own data, and spit it out in the right order. Problem is it just seems to spit out the last Node I added and it doesn't order them right. I'm not sure why, Im going over my code, and im drawing blanks as to what could be causing this issue. any and all help would be appreciated.</p>

<p>This is my main class</p>

<pre><code>    public class BinarySearchTree {

    NodeClass root;

    public void addNode(DataType data) {



        NodeClass newNode = new NodeClass(data);



        if (root == null) {

            root = newNode;

        } else {



            NodeClass helperNode = root;



            NodeClass parent;

            while (true) {



                parent = helperNode;



                if (data.studentID &lt; helperNode.data.studentID) {



                    helperNode = helperNode.leftChild;



                    if (helperNode == null) {



                        parent.leftChild = newNode;
                        return; 

                    }

                } else { 

                    helperNode = helperNode.rightChild;



                    if (helperNode == null) {



                        parent.rightChild = newNode;
                        return; // All Done

                    }

                }

            }
        }

    }


    public void inOrderTraverseTree(NodeClass helperNode) {

        if (helperNode != null) {



            inOrderTraverseTree(helperNode.leftChild);



            System.out.println(helperNode);



            inOrderTraverseTree(helperNode.rightChild);

        }

    }

    public void preorderTraverseTree(NodeClass helperNode) {

        if (helperNode != null) {

            System.out.println(helperNode);

            preorderTraverseTree(helperNode.leftChild);
            preorderTraverseTree(helperNode.rightChild);

        }

    }

    public void postOrderTraverseTree(NodeClass helperNode) {

        if (helperNode != null) {

            postOrderTraverseTree(helperNode.leftChild);
            postOrderTraverseTree(helperNode.rightChild);

            System.out.println(helperNode);

        }

    }

    public NodeClass findNode(int ID) {



        NodeClass helperNode = root;



        while (helperNode.data.studentID != ID) {



            if (ID &lt; helperNode.data.studentID) {



                helperNode = helperNode.leftChild;

            } else {



                helperNode = helperNode.rightChild;

            }

            // The node wasn't found

            if (helperNode == null)
                return null;

        }

        return helperNode;

    }

public static void main(String[] args) {

    DataType[] data = new DataType[10];
    data[0] = new DataType();
    data[1] = new DataType();
    data[2] = new DataType();
    data[3] = new DataType();
    data[4] = new DataType();
    data[5] = new DataType();
    data[6] = new DataType();
    data[7] = new DataType();
    data[8] = new DataType();
    data[9] = new DataType();


        BinarySearchTree theTree = new BinarySearchTree();

        data[0].studentID = 77;
        data[0].letterID = 'M';
        data[0].name = "Homer";
        data[0].GPA = 3.5;

        data[1].studentID = 87;
        data[1].letterID = 'W';
        data[1].name = "Bart";
        data[1].GPA = 2.0;

        data[2].studentID = 69;
        data[2].letterID = 'E';
        data[2].name = "Lisa";
        data[2].GPA = 0.5;

        data[3].studentID = 79;
        data[3].letterID = 'O';
        data[3].name = "Marge";
        data[3].GPA = 2.3;

        data[4].studentID = 81;
        data[4].letterID = 'Q';
        data[4].name = "Ned";
        data[4].GPA = 1.6;

        data[5].studentID = 73;
        data[5].letterID = 'I';
        data[5].name = "Burns";
        data[5].GPA = 1.9;

        data[6].studentID = 84;
        data[6].letterID = 'T';
        data[6].name = "Apu";
        data[6].GPA = 2.2;

        data[7].studentID = 71;
        data[7].letterID = 'G';
        data[7].name = "Selma";
        data[7].GPA = 2.7;

        data[8].studentID = 80;
        data[8].letterID = 'P';
        data[8].name = "Max";
        data[8].GPA = 3.5;

        data[9].studentID = 75;
        data[9].letterID = 'K';
        data[9].name = "Nelson";
        data[9].GPA = 3.6;

         theTree.addNode((data[0]));
         theTree.addNode((data[1]));
         theTree.addNode(data[2]);
         theTree.addNode((data[3]));
         theTree.addNode((data[4]));
         theTree.addNode(data[5]);
         theTree.addNode((data[6]));
         theTree.addNode((data[7]));
         theTree.addNode(data[8]);
         theTree.addNode((data[9]));




        // Different ways to traverse binary trees

        //theTree.inOrderTraverseTree(theTree.root);

        // theTree.preorderTraverseTree(theTree.root);

        // theTree.postOrderTraverseTree(theTree.root);

        // Find the node with key 75

    //  System.out.println("\nStudent with the ID 77");

//      System.out.println(theTree.findNode(69));

}
}
</code></pre>

<p>This is the DataType that it's supposed to take</p>

<pre><code>public class DataType {

    public static int studentID;
    public char letterID;
    public static String name;
    public double GPA;

public DataType () 
{
    studentID = studentID;
    letterID = letterID;
    name = name;
    GPA = GPA;


}



public String toString () //otherwise we get refrences 
{
    return "(studentID | " + studentID + "| letterID | " + letterID + "| name | " + name + "GPA" + GPA + "|)";
}

}
</code></pre>

<p>And this is the NodeClass I had to create</p>

<pre><code>public class NodeClass
{
    public DataType data;       //our data to pass in

    public NodeClass leftChild;

    public NodeClass rightChild;



    public NodeClass(DataType dataClass)        //our constructor 
    {
        data = dataClass;                       

        leftChild = null;

        rightChild = null;
    }

     public String toString() {



                   // return DataType.name + " has the key " + DataType.studentID;





                      return DataType.name + " has the ID " + DataType.studentID + "\nLeft Child: " + leftChild +

                      "\nRight Child: " + rightChild + "\n";





                }
}
</code></pre>