for (i=0;i<=9;i++);//注意这里多了一个分号
   System.out.print(" "+stack.pop());

解决方案 »

  1.   

    大哥,你检查一下你的代码吧
    import java.util.*;class test_of {
     public static void main (String args[]){
      int i;
      Stack stack=new Stack();
      for (i=0;i<=9;i++)
       stack.push(new Integer(i));
      for (i=0;i<=9;i++);
                        …这个分号干什么吃的,当然只有9了
       System.out.print(" "+stack.pop());  System.out.println();
     }
    }
      

  2.   

    import java.util.*;class test_of {
     public static void main (String args[]){
      int i;
      Stack stack=new Stack();
      for (i=0;i<=9;i++)
       stack.push(new Integer(i));
      for (i=0;i<=9;i++)
       System.out.print(" "+stack.pop());  System.out.println();
     }
    }这样就对了for (i=0;i<=9;i++);
    语句多了个;号.
    以后仔细点。