本帖最后由 陈虹旭 于 2012-10-19 14:17 编辑
- <P>import java.util.*;
- class DuiLie
- {
- private LinkedList link;
- DuiLie()
- {
- link = new LinkedList();
- }
- public void myadd(Object obj)
- {
- link.offerFirst();
- }
- public Object myget()
- {
- return pollLast();
- }
- public boolean isNull()
- {
- return link.isEmpty();
- }
- }
- </P>
- <DIV class=blockcode>
- <BLOCKQUOTE>class DuiLieDuiZhanDemo
- {
- public static void main(String[] args)
- {
- DuiLie dl = new DuiLie();
- dl.myadd("java01");
- dl.myadd("java02");
- dl.myadd("java03");
- dl.myadd("java04");
- System.out.println(dl);
- }
- }
复制代码
为什么会提示这个错误呢? 哪里错了?
|