this.head = 0;
this.end = 0;
this.size = 0;
}
public void push(Object object) throws Exception {
if (this.size > objects.length)
throw new Exception("Queue is full!");
objects[end++] = object;
size++;
}
public Object pop() throws Exception {
if (this.size == 0)
// return null;
throw new Exception(“Queue is empty!”);
if (head == objects.length)
this.head = 0;
size–;
return objects[head++];
}
public Object peek() throws Exception {
if (this.size == 0)
throw new Exception("Queue is empty!");
return objects[head];
}
public boolean isEmpty() {
return size == 0;
}
public boolean isFull() {
return size == objects.length;
}
public int getSize() {
return size;
}
}