Friday, 19 March 2021

PriorityQueue in Java

 import java.util.*;

class CL4

{

public static void main(String[] args)

{

PriorityQueue<String> A1=new PriorityQueue<String>();

A1.add("Ram");

A1.add("Raj");

A1.add("Raman");

A1.add("Rajan");

A1.remove();

Iterator itr=A1.iterator();

while(itr.hasNext())

{

System.out.println(itr.next());

}

}

}

No comments:

Post a Comment