Question 5 Consider the following Node class and Movie class The instance variables title and next are declared public s
Posted: Fri Jul 08, 2022 6:43 am
Question 5 Consider the following Node class and Movie class The instance variables title and next are declared public so there is no need to use any accessor or mutator methods such as getNext, getName, setNext or setName. reach node contains a string and a pointer to the next Rode Weach node contains a string and a pointer to the next Node class Node public String title: public Node next: public Node(String title) I this.title= title: 1 public Node) 1 title- null: A list of Nodes class Movie 1 Node front: public Moviel String title) ( front - new Node(title) 1 add nodes to the list public void add/Strings) [ Node cur front: while(cur.next!- null) t cur- cur.next 1 Node n new Nodels): curnext-n n.next new Nodels: 1 4 pts 1 class Driver 1
public static void main(String[] args) ( Movie list new Movie("Trailer"); M list.add("Wizard"); list.add("Vertigo"); list.add("Godfather"); list.add("Sunset"); } What would be the content of the list from left to right. Enter your answers with the correct spelling otherwise it will be marked as incorrect The add method is not a simple add. please examine the code in the add method very carefully before entering your answers. Your answers" --> --> --> î ↑
public static void main(String[] args) ( Movie list new Movie("Trailer"); M list.add("Wizard"); list.add("Vertigo"); list.add("Godfather"); list.add("Sunset"); } What would be the content of the list from left to right. Enter your answers with the correct spelling otherwise it will be marked as incorrect The add method is not a simple add. please examine the code in the add method very carefully before entering your answers. Your answers" --> --> --> î ↑