class="java" name="code"> public class Node { Object value; Node next; public Node(Object value) { this.value = value; } } void reverse(Node head) { Node previous = null; if (head == null) { return; } while (head != null) { Node nextNode = head.next; head.next = previous; previous = head; head = nextNode; } }