import java.util.Vector;public class Queue extends Vector{  byte  pock_rev[] = new byte[256];
  byte i;  public Queue(){
    super();
  }  public   void  Push(){    for(i = 0;i<256;i++){
pock_rev[i] = i;
}
    Vector.add(pock_rev);
  }  public  byte[]  Pop(){    return ((byte [])Vector.firstElement());  }  public  boolean Is_Empty(){    return  (Vector.isEmpty());  }
  public static void main(String [] args)
{
  Queue queue = new Queue();
  queue.Push();
}}编译时提示:无法从静态上下文中引用非静态方法 add(E)
            无法从静态上下文中引用非静态方法 firstElement    
            无法从静态上下文中引用非静态方法 isEmpty()我很郁闷,我哪里设置静态上下文了? 

解决方案 »

  1.   

    Vector v = new Vector();v.add
    v.isEmpty
    v.firstElement
      

  2.   

    楼上的,我就是想继承Vector,然后多此一举 写Pop 和 Push 函数
      

  3.   

    public static void main(String [] args) <-----你在这就设定静态啦。
    每个main必须是静态的。
      

  4.   

    如果你不是通过impot来加载的这个类,感觉就会出这个问题。