package Problem5;
import java.util.Stack;
//首先定义链表结构
class LinkNode{
LinkNode next;
int node_value;
}
public class PrintListReverse {
public void reverse(LinkNode headNode){
//用栈的思想来实现链表的倒序输出
Stack<LinkNode> stack=new Stack<LinkNode>();
while(headNode!=null){
stack.push(headNode);
headNode=headNode.next;
}
while(!stack.isEmpty()){
System.out.print(stack.pop().node_value+" ");
}
System.out.println();
}