this peek(method returns the value at the front of the queue some queue implementations have rearpeek(and frontpeek(methodbut usually you want to know what you're about to removenot what you just inserted new if you want to start with an empty queueyou can use the new button to create one empty and full if you try to remove an item when there are no more items in the queueyou'll get the can' removequeue is empty error message if you try to insert an item when all the cells are already occupiedyou'll get the can' insertqueue is full message circular queue when you insert new item in the queue in the workshop appletthe front arrow moves upwardtoward higher numbers in the array when you remove an itemrear also moves upward try these operations with the workshop applet to convince yourself it' true you may find the arrangement counter-intuitivebecause the people in line at the movies all move forwardtoward the frontwhen person leaves the line we could move all the items in queue whenever we deleted onebut that wouldn' be very efficient instead we keep all the items in the same place and move the front and rear of the queue the trouble with this arrangement is that pretty soon the rear of the queue is at the end of the array (the highest indexeven if there are empty cells at the beginning of the arraybecause you've removed them with remyou still can' insert new item because rear can' go any further or can itthis situation is shown in figure wrapping around to avoid the problem of not being able to insert more items into the queue even when it' not fullthe front and rear arrows wrap around to the beginning of the array the result is circular queue (sometimes called ring bufferyou can see how wraparound works with the workshop applet insert enough items to bring the rear arrow to the top of the array (index remove some items from the front of the array nowinsert another item you'll see the rear arrow wrap around from index to index the new item will be inserted there this is shown in figure