Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Comparator;
import java.util.PriorityQueue;

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

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

        // insert values in the queue
        prq.add(1);
        prq.add(2);
        prq.add(3);
        prq.add(6);
        prq.add(5);

        System.out.println(prq);

        // create comparator
        Comparator comp = prq.comparator();

        System.out.println("Comparator value is: " + comp);
    }
}