title: Why does this throw an InterruptedException?
body: <p><img src="https://i.stack.imgur.com/T7Z64.png" alt="enter image description here"></p>
  
  <p>This code should compile, should it not?  What am I doing wrong?   I would like the code to briefly pause before displaying each number in the array.</p>
  
  <pre><code>public static void median(int odd[]) throws InterruptedException {
  
      Arrays.sort(odd);
  
      for (int i = 0; i &lt; odd.length; i++) {
          System.out.println(odd[i]);
          Thread.sleep(500);
      }
      System.out.println("The median number of the previous list of numbers is: " + odd[5]);
  }
  </code></pre>