public class LinkReverse2 { public static Node mhead=null; public static Node mtail=null; public static Node newLink(int n){ Node head = new Node(); head.setData(1); head.setNext(null); Node tmp = head; for(int i=2;i<=n;i++){ Node newNode = new Node(…