import java.util.*;
class DuiLie
{
private LinkedList link;
DuiLie()
{
link=new LinkedList();
}
public void myadd(Object obj)
{
link.addFirst(obj);
}
public Object myget()
{
return link.removeFirst();
}
public boolean isNull()
{
return link.isEmpty();
}
}
class LinkedListTest
{
public static void main (String[]args)
{
DuiLie dl=new DuiLie();
dl.myadd("java01");
dl.myadd("java02");
dl.myadd("java03");
while(!dl.isNull())
{
System.out.println(dl.myget());
}
}
}
编译没问题,运行出现:找不到或无法加载主类 LinkedList
set classpath=D:\jdk1.8.0_05\src.zip
是不是包的引用错了 |
|