+ 1
Explain code
package PriortyQueue; import java.util.PriortyQueue; class pqueue{ public static void main(String[]args){ PriortyQueue<String> pq = new PriortyQueue<>(); pq.add("kiwi"); pq.add("apple"); pq.add("mango"); pq.add("banana"); System.out.println(pq.remove()); System.out.println(pq.remove()); System.out.println(pq.remove()); System.out.println(pq.remove()); } }
6 odpowiedzi
+ 4
Well, not here with an explanation, but I noticed typo in class name, which prevents code from running.
Change all 'PriortyQueue' to 'PriorityQueue' you missed an 'i' in that class name.
+ 1
plz help me
+ 1
But not work your suggestions
+ 1
Ohk
+ 1
My mistake
+ 1
import java.util.*;
public class GFG {
public static void main(String args[])
{
Queue<String> pq = new PriorityQueue<>();
pq.add("kevi");
pq.add("banana");
pq.add("mengo");
pq.remove("kevi");
System.out.println(pq);
}
}