title: Java Natural ordering
body: <p>I'm trying to use a priorityqueue and I assume the elements are added in the "natural order"..</p>
  
  <p>WHen I print the elements its not in sorted order..I would expect the result- 1,2,3,4</p>
  
  <pre><code>package scratch;
  import java.util.*;
  
  public class test {
      public static void main(String[] args) {
          PriorityQueue&lt;String&gt; pq = new PriorityQueue&lt;String&gt;();
          pq.add("2");
          pq.add("4");
          System.out.println(pq.peek()+" ");
          pq.offer("1");
          pq.add("3");
          System.out.println(pq);
          /*System.out.println(pq.poll() + " ");
          System.out.println(pq);*/
      }
  
  }
  </code></pre>
  
  <p>OUtput:</p>
  
  <p>2 
  [1, 3, 2, 4]</p>