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()我很郁闷,我哪里设置静态上下文了?
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()我很郁闷,我哪里设置静态上下文了?
v.isEmpty
v.firstElement
每个main必须是静态的。