Write a program using queue data structure , add the three aplhabates a,b,c and remove the b .
import java.util.*;
public class simplequeue {
public static void main(String args[])
{
Queue<String> pq = new PriorityQueue<>();
pq.add("a");
pq.add("b");
pq.add("c");
System.out.println(pq);
pq.remove("b");
System.out.println(pq);
}
}
outptut:
[a, b, c]
[a, c]
No comments:
Post a Comment