日期:2014-05-20 浏览次数:20854 次
package com.zf.link;
public class Test2 {
    //打印结果 为的多少 , 心算
    public static void main(String[] args) {
        
        Node n1 = new Node(1);
        Node n2 = new Node(2);
        Node n3 = new Node(3);
        
        n1.setNext(n2);
        n2.setNext(n3);
        
        n2 = n2.next();
        
        System.out.println(n2.data);    
        System.out.println(n1.next().data);
        
        
    }
    
}
class Node{
    
    public int data ;
    
    private Node next ;
    
    public Node(int data){
        this.data = data ;
    }
    
    public void setNext(Node node){
        next = node;
    }
    
    public Node next(){ 
        return next;
    }
    
}