class Node
{
private Object obj;
private Node next;
//用数据域构造一个节点对象
public Node(Object obj)
{
this.obj=obj;
}
//返回下一节点的对象
public Node getNext()
{
return this.next;
}
//设置本节点的链域
public void setNext(Node next)
{
this.next=next;
}
//返回节点的数据域
public Obj getName()
{
return this.obj;
}
//判断是否有下一节点
public boolean hasNext()
{
boolean is=false;
if(this.next!=null)
{
is=true;
}
return is;
}
}
Java实现链表之结点
最新推荐文章于 2022-05-18 21:18:33 发布