PriorityQueue class add(E e)method example

Inserts the specified element into this priority queue.


PriorityQueueclass add(E e)method example. This example shows you how to use add(E e)method.This method Inserts the specified element into this priority queue.

Here is the code:-

/**
 * @Program that Inserts the specified element into this priority queue.
 * Add.java 
 * Author:-RoseIndia Team
 * Date:-28-May-2008
 */
import java.util.*;

public class Add {

    public static void main(String[] args) {
        PriorityQueue P = new PriorityQueue();
        //Inserts the specified element into this priority queue.
        P.add("Girish");
        P.add("Tewari");
        System.out.println("Add new Object :" + P.add("RoseIndia"));
        System.out.println("Elements in the PriorityQueue are: " + P);

    }
}

Output of the program:-
Add new Object :true
Elements in the PriorityQueue are: [Girish, Tewari, RoseIndia]

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US