Untitled

mail@pastecode.io avatar
unknown
java
a year ago
550 B
1
Indexable
Never
package Assignment2;

import java.util.*;

public class Q1
{
    public static void main(String[] args)
    {
        Queue<Integer> queue = new PriorityQueue<>();
        queue.add(1);
        queue.add(17);
        queue.add(40);
        queue.add(52);
        queue.add(76);
        System.out.println("Here is how the queue looks like: " + queue);
        System.out.println("The first integer  in the queue is : " + queue.peek());
        queue.remove(76);
        System.out.println("After removing 76 the queue looks like: " + queue);
    }
}