X403: changePointeeNext1

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
Write a single assignment statement to remove the Node with info 'B' from the linked list headed by p. Given that the list L contains the elements [A,B,C] and p points to A and q points to C. You must refer to both p and q in your assingment statement.

Initial Setup Final Configuration

Your Answer:

x
 
1
public static Link changeNext(Link p, Link q)
2
{
3
    
4
    return p;
5
}
6
Reset
Visualize

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.