Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java程序找不到符号 公共类平面演示 { 公共静态void main(字符串参数[]) { ArrayQueue q=新的ArrayQueue(); 飞机p1=新飞机(“飞机1”,3); 飞机p2=新飞机(“飞机2”,1); 飞机p3=新飞机(“飞机3”,2); q、 addQueue(p1); q、 addQueue(p2); q、 addQueue(p3); 而(!q.isEmptyQueue()) { 系统输出打印项次(“车辆:”); System.out.println(q.front()); q、 deleteQueue(); } } } 找不到符号 q、 addQueue(p1); ^ 符号:方法addQueue(平面) 位置:ArrayQueue类型的变量q 错误:找不到符号 q、 addQueue(p2); ^ 符号:方法addQueue(平面) 位置:ArrayQueue类型的变量q_Java - Fatal编程技术网

Java程序找不到符号 公共类平面演示 { 公共静态void main(字符串参数[]) { ArrayQueue q=新的ArrayQueue(); 飞机p1=新飞机(“飞机1”,3); 飞机p2=新飞机(“飞机2”,1); 飞机p3=新飞机(“飞机3”,2); q、 addQueue(p1); q、 addQueue(p2); q、 addQueue(p3); 而(!q.isEmptyQueue()) { 系统输出打印项次(“车辆:”); System.out.println(q.front()); q、 deleteQueue(); } } } 找不到符号 q、 addQueue(p1); ^ 符号:方法addQueue(平面) 位置:ArrayQueue类型的变量q 错误:找不到符号 q、 addQueue(p2); ^ 符号:方法addQueue(平面) 位置:ArrayQueue类型的变量q

Java程序找不到符号 公共类平面演示 { 公共静态void main(字符串参数[]) { ArrayQueue q=新的ArrayQueue(); 飞机p1=新飞机(“飞机1”,3); 飞机p2=新飞机(“飞机2”,1); 飞机p3=新飞机(“飞机3”,2); q、 addQueue(p1); q、 addQueue(p2); q、 addQueue(p3); 而(!q.isEmptyQueue()) { 系统输出打印项次(“车辆:”); System.out.println(q.front()); q、 deleteQueue(); } } } 找不到符号 q、 addQueue(p1); ^ 符号:方法addQueue(平面) 位置:ArrayQueue类型的变量q 错误:找不到符号 q、 addQueue(p2); ^ 符号:方法addQueue(平面) 位置:ArrayQueue类型的变量q,java,Java,我很害怕这很快就要到期了,我不知道我做错了什么 cannot find symbol q.addQueue(p1); ^ symbol: method addQueue(Plane) location: variable q of type ArrayQueue<Plane> error: cannot find symbol q.addQueue(p2); ^ symbol: method addQueue(

我很害怕这很快就要到期了,我不知道我做错了什么

cannot find symbol
      q.addQueue(p1);
       ^
  symbol:   method addQueue(Plane)
  location: variable q of type ArrayQueue<Plane>

error: cannot find symbol
      q.addQueue(p2);
       ^
  symbol:   method addQueue(Plane)
  location: variable q of type ArrayQueue<Plane>
公共类数组队列
{
私有整数最大队列大小;
私人整数计数;
私人前线;
私家车;
私人T[]名单;
公共阵列队列()
{
maxQueueSize=100;
queueFront=0;
queueRear=maxQueueSize-1;
计数=0;
list=(T[])新对象[maxQueueSize];
}
公共阵列队列(整数队列大小)
{
如果(队列大小更换此

    public class ArrayQueue<T>
{
    private int maxQueueSize;
    private int count;
    private int queueFront;
    private int queueRear;
    private T[] list;

    public ArrayQueue()
    {
        maxQueueSize = 100;
        queueFront = 0;
        queueRear = maxQueueSize - 1;
        count = 0;
        list = (T[]) new Object[maxQueueSize];
    }

    public ArrayQueue(int queueSize)
    {
        if(queueSize <= 0)
        {
            System.err.println("Array size must be a positive number. Creating array at default size of 100.");
            maxQueueSize = 100;
        }
        else
            maxQueueSize = queueSize;

        queueFront = 0;
        queueRear = maxQueueSize - 1;
        count = 0;
        list = (T[]) new Object[maxQueueSize];
    }

    public void initializeQueue()
    {
        for(int i = queueFront; i < queueRear; i = (i + 1) % maxQueueSize)
        list[i] = null;

        queueFront = 0;
        queueRear = maxQueueSize - 1;
        count = 0;
    }

    public boolean isEmptyQueue()
    {
        return(count == 0);
    }

    public boolean isFullQueue()
    {
        return(count == maxQueueSize);
    }

    public T peek() //throws QueueUnderflowException
    {
        /*if(isEmptyQueue())
            throw new QueueUnderflowException();*/

        return (T) list[queueFront];
    }

    /*public T back() throws QueueOverflowException
    {
        if(isFullQueue())
            throw new QueueUnderflowException();
        return (T) list[queueRear];
    }
*/
    public void enqueue(T queueElement) throws QueueOverflowException
    {
        if(isFullQueue())
            throw new QueueOverflowException();

        queueRear = (queueRear + 1) % maxQueueSize;
        count++;
        list[queueRear] = queueElement;
    }

    public void dequeue() throws QueueUnderflowException
    {
        if(isEmptyQueue())
            throw new QueueUnderflowException();

        count--;
        list[queueFront] = null;

        queueFront = (queueFront + 1) % maxQueueSize;
    }
}
对于此
q.enqueue(p1);etc
cause是唯一必须向类添加元素的方法

q.addQueue(p1);
q.addQueue(p2);
        q.addQueue(p3);

ArrayQueue
的javadoc说什么?你能导入ArrayQueue吗?ArrayQueue是你写的类吗?仔细检查方法名是的ArrayQueue是我写的类我刚刚发布了它你需要调用enqueue而不是addQueue
q.addQueue(p1);
q.addQueue(p2);
        q.addQueue(p3);
public void enqueue(T queueElement) throws QueueOverflowException
    {