title: Fixing Error: Unreported Exception InterruptedException
body: <p>I'm new to Java. I was just searching how to make a Java program wait, and it said to use the <code>Thread.sleep()</code> method. However, when I do this it comes up with an error:</p>
  
  <blockquote>
    <p>error: unreported exception InterruptedException; must be caught or declared to be thrown</p>
  </blockquote>
  
  <p>I fixed that by adding <code>throws InterruptedException</code> to the method declaration, and now it works.</p>
  
  <p>However, when calling the method, I got the error again. People say to use a throw and catch block, but I'm not sure how to do that yet. Could somebody help me here?</p>
  
  <p>Anyways, code for Draw.java (with sleep() method):</p>
  
  <pre><code>package graphics.utilities;
  
  public class Draw {
    public static void DS(int[] c)
      throws InterruptedException {
      \\ .. Drawing Algorithms
      Thread.sleep(2000);
      \\ .. More Drawing Algorithms
    }
  }
  </code></pre>
  
  <p>And in Square.java (calling DS()):</p>
  
  <pre><code>package graphics.shapes;
  
  import graphics.utilities.*;
  
  public class Square implements Graphics {
    int x1,y1,s;
    public Square(int x1,int y1,int s) {
      this.x1 = x1;
      this.y1 = y1;
      this.s = s;
    }
    public void GC() {
      System.out.printf("Square Coordinates:%n Start Point:%n  x: %d%n  y: %d%n Height/Width: %d%n%n" , this.x1,this.y1,this.s);
    }
    public void D() {
      int x2 = x1 + s;
      int y2 = y1;
      int x3 = x1 + s;
      int y3 = y1 + s;
      int x4 = x1;
      int y4 = y1 + s;
  
      int[] c = {x1,y1,x2,y2,x3,y3,x4,y4};
      Draw.DS(c);
    }
  }
  </code></pre>
  
  <p>Thanks.</p>