Question: Programming Language: Java Create your own queue interface with the following method: add(element) this method is used to add elements at the tail of the

Programming Language: Java

  1. Create your own queue interface with the following method:
    1. add(element) this method is used to add elements at the tail of the queue.is method
    2. poll() this method removes and returns the head of the queue. It returns null if the queue is empty.
    3. peek() this method is used to view the head of the queue without removing it. It returns null if the queue is empty.
    4. isEmpty() this method returns true if queue is empty.
    5. size() this method returns the number of elements in the queue. Write also a program to implement your interface. Test all our method, Print screen the output, write a comment and make it neat.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!