//QuestionNodes have a String data field as well as a reference to two other QuestionNodes. public class QuestionNode{ public String data; public QuestionNode yes; public QuestionNode no; //Constructs a new QuestionNode with no references so it is a leaf node. public QuestionNode(String data){ this(data, null, null); } //Constructs a QuestionNode with references to the two specifified QuestionNodes. public QuestionNode(String data, QuestionNode yes, QuestionNode no){ this.data = data; this.yes = yes; this.no = no; } //Checks it the QuestionNode is a leaf node. public boolean isAnswer(){ return yes == null && no == null; } }