how do i print priority questions with custom objects in java?

You could use an Iterator since PriorityQueue implements Iterable:

Iterator it = pq.iterator();
while (it.hasNext()) { 
    Mhswa value = it.next();
    System.out.println("Data ke " + i + " : " + value.nama + " " + value.thnMasuk);
    i++;
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top