/* Write Java statements that create a linked list pictured in T07Q1. a) Write a method called createLinkedList1 to create the above linked list beginning with an empty linked list, first create and attach a node for A, then create and attach a node for B, and finally create and attach a node for C. b) Similar to Part a), write a method called createLinkedList2 to create the above linked list, but instead create and attach nodes in the order C, B, A. */ public class T07Q1answer { public static void main (String [] arg) { Node.printList(createLinkedList1()); Node.printList(createLinkedList2()); } // T07Q1.a public static Node createLinkedList1() { Node head = new Node ("A"); Node secondNode = new Node ("B"); head.setNext(secondNode); Node thirdNode = new Node ("C", null); secondNode.setNext(thirdNode); return head; } // T07Q1.b public static Node createLinkedList2() { Node head = new Node ("C", null); Node newNode = new Node ("B", head); head = newNode; newNode = new Node ("A", head); head = newNode; return head; } }