Topic: 请高手帮我找一个错误。unchecked call to push(E)..

  Print this page

1.请高手帮我找一个错误。unchecked call to push(E).. Copy to clipboard
Posted by: hijack2005
Posted on: 2005-11-19 21:11

import java.util.Stack;
public class TestStack
{
  public static void main(String[] args)
  {
    Stack s=new Stack();
    s.push("wo");
    s.push("ri");
    while(s.pop()!=null){
      System.out.println("Hello World!");
    }
  }
}
这个为全部原代码,但编译出现如图下的错误,请教一下。

2.Re:请高手帮我找一个错误。。 [Re: hijack2005] Copy to clipboard
Posted by: anatoranato
Posted on: 2005-11-19 22:55

这成这样吧.不过你得用1.5.0以上的JRE
import java.util.Stack;
public class TestStack
{
public static void main(String[] args)
{
Stack<String> s=new Stack<String>();
s.push("wo");
s.push("ri");
while(!s.empty()){
System.out.println(s.pop());
}
}
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923