package day13wawakaka;
import java.util.LinkedList;
public class D04 {
public static void main(String[] args) {
Duilie dl=new Duilie();
dl.myAdd("java1");
dl.myAdd("java2");
dl.myAdd("java3");
while(!dl.isNull())
{
System.out.println(dl.myGet());
}
}
}
class Duilie
{
private LinkedList link;
Duilie()
{
link=new LinkedList();
}
public void myAdd(Object obj)
{
link.add(obj);
}
public Object myGet()
{
return link.removeFirst();
}
public boolean isNull()
{
return link.isEmpty();
}
} |