一个栈的实现方法,代码如下:
import java.util.*;
class MyStack{
private LinkedList l=new LinkedList();
public void push(Object o){
l.addFirst(o);
}
public Object peek(){
return l.getFirst();
}
public Object pop(){
return l.removeFirst();
}
public boolean empty(){
return l.isEmpty();
}
public static void main(String[] args){
MyStack m=new MyStack();
m.push("one");
m.push("two");
m.push("three");
m.push("four");
System.out.println(m.pop());
System.out.println(m.peek());
System.out.println(m.pop());
System.out.println(m.empty());
System.out.println(m.pop());
System.out.println(m.pop());
System.out.println(m.empty());
}
}
编译时出现如下错误:
Note: MyStack.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
请教各位大侠 这中情况是我哪个地方写错了呢?