Java Class

About

I started this website for my Java students.
Site Map | Resources | Online Math Games | Fraction Games Online | TOS | Programming Homework Help Sitemap
import java.util.*;

public class PriorityQueueDemo {

PriorityQueue<String> stringQueue;


public static void main(String[] args){
stringQueue = new PriorityQueue<String>(); stringQueue.add("ab"); stringQueue.add("abcd"); stringQueue.add("abc"); stringQueue.add("a"); //don't use iterator which may or may not //show the PriorityQueue's order while(stringQueue.size() > 0) System.out.println(stringQueue.remove()); } }