Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.PriorityQueue;

public class Main {
    public static void main(String args[]) {

        PriorityQueue<Integer> prq = new PriorityQueue<Integer>();

        for (int i = 3; i < 10; i++) {
            prq.add(i);
        }

        System.out.println(prq);

        // get the head from the queue
        Integer head = prq.peek();

        System.out.println("Head of the queue is: " + head);
    }
}