Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to use the linkedList class and create a method. import java.util.*; publ

ID: 3627926 • Letter: I

Question

I need to use the linkedList class and create a method.
import java.util.*;


public class linkedList<E>
{
static public void main(String args[]) {

linkedList<String> list1 = new linkedList<String>();
list1.pushFront("red");
list1.pushBack("blue");
list1.pushFront("brown");
list1.pushBack("green");
list1.printList();


linkedList<String> list2 = new linkedList<String>();
list2.pushFront("purple");
list2.pushBack("yellow");
list2.pushFront("magenta");
list2.printList();


}

Explanation / Answer

Make the method: linkedList concatenateLists(linkedList list1) { //method } Then call it in the program with list1.concatenateLists(list2); Assuming your concatenate lists method is correct, that is how you call it. Since you have instances of the lists, you call the method of one list, sending it the second list as a parameter