title: I/O Error Exception Handling: Unreachable catch block for IOException. This exception is never thrown from the try statement body
body: <p>I'm currently working on an assignment (Java) for school. In the instructions/rubric, I'm told that I need to use I/O Exception Handling for command line arguments and other things.</p>
  
  <p>**What The Program Needs to do: **</p>
  
  <p>Take two command line arguments when it runs, or else throw an error. 
  The rubric includes this requirement : "I/O error handling is done if no command arguments"</p>
  
  <p>The problem is, every time I try to use an I/O exception catch, I receive this error: </p>
  
  <p><strong>"Unreachable catch block for IOException. This exception is never thrown from the try statement body"</strong></p>
  
  <p>The quick fix suggestions I get from Eclipse:<br>
  1. Remove Catch clause
  2. Replace Catch clause with close</p>
  
  <p><strong>Here is my Code:</strong></p>
  
  <pre><code>import java.awt.Robot;
  import java.io.BufferedReader;
  import java.io.File;
  import java.io.IOException;
  
  public class DecipherText {
      public static void main(String[] args) throws IOException { 
          String firstArg;
          String secondArg;
  
          if (args.length &gt; 0) {
              try {
                  firstArg = args[0];
                  secondArg = args[1];
              } catch (IOException e) {
                  System.out.println("Usage Error: Not enough Arguments");
                  System.out.println(e);
                  return;
              }
          }
  
          String inputFile = args[0];
          String outputFile = args[1];
      }
  
      public static boolean receiver() { 
          return false;
      }
  
      public static boolean output() { // Outputs The Final File
          return false;
      }
  }
  </code></pre>
  
  <p>My question(s) are:</p>
  
  <ol>
  <li>If so, what am I doing wrong?</li>
  <li>Is this requirement impossible/asking for the wrong usage of the I/O Error exception handling?</li>
  </ol>
  
  <p>Any help is greatly appreciated.
  Thanks,
  Sully</p>