+ 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()); } }

27th Jul 2020, 9:35 AM
HALAI JAYESHKUMAR
HALAI JAYESHKUMAR - avatar
6 Réponses
+ 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.
27th Jul 2020, 10:00 AM
Ipang
+ 1
plz help me
27th Jul 2020, 9:36 AM
HALAI JAYESHKUMAR
HALAI JAYESHKUMAR - avatar
+ 1
But not work your suggestions
27th Jul 2020, 10:07 AM
HALAI JAYESHKUMAR
HALAI JAYESHKUMAR - avatar
+ 1
Ohk
27th Jul 2020, 10:08 AM
HALAI JAYESHKUMAR
HALAI JAYESHKUMAR - avatar
+ 1
My mistake
27th Jul 2020, 10:08 AM
HALAI JAYESHKUMAR
HALAI JAYESHKUMAR - avatar
+ 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); } }
27th Jul 2020, 10:54 AM
HALAI JAYESHKUMAR
HALAI JAYESHKUMAR - avatar