菜鸟急求一道JAVA题,高手们花几分钟提点一下小弟吧.不胜感激
模版是这样的
package Chap05.linkList;
// linkList.java
// demonstrates linked list
// to run this program: C> java LinkListApp
////////////////////////////////////////////////////////////////
class Link
{
public int iData; // data item
public double dData; // data item
public Link next; // next link in list
// -------------------------
public Link(int id, double dd) // constructor
{
iData = id; // initialize data
dData = dd; // ( 'next ' is automatically
} // set to null)
// -------------------------
public void displayLink() // display ourself
{
System.out.print( "{ " + iData + ", " + dData + "} ");
}
} // end class Link
////////////////////////////////////////////////////////////////
class LinkList
{
private Link first; // ref to first link on list
// -------------------------
public LinkList() // constructor
{
first = null; // no links on list yet
}
// -------------------------
public boolean isEmpty() // true if list is empty
{
return (first==null);