title: Errors while trying to handle a catch block
body: <p>So right now I am coding a program that takes in user input, which is recipes, and reads the recipes from a different file and then outputs the recipe to a new file called "ShoppingList.txt". I am trying to create the file but when I try to compile the program I am presented with this error.
   RecipeList.java:80: error: exception FileNotFoundException is never thrown in body of corresponding try statement
                  catch(FileNotFoundException e) Can someone help me debug it. Thank you!</p>
  
  
  
  
  
  <pre><code>//Prasanth Dendukuri
  // 2/5/18
  // RecipeList.java
  
  
  import java.util.Scanner;
  import java.io.File;
  import java.io.PrintWriter;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  
  public class RecipeList
  {
      private Scanner terminal; // to read in input from kb
      private Scanner reader; // to read in from the text fi;e
      private String inFileName; // name of file to read from
      private String outFileName; // name of file to output to
      private String[] recipeList; // array that contains the recipes
      private String[] ingredients; // array that contains ingredients for each recipe
      private PrintWriter output; // print writer for writing to output file
      private String input; // to accept input and store in this variable
      private int numInput; // num of recipes entered
      private Scanner file; // scanner used for reading in from file
  
      public RecipeList()
      {
          terminal = new Scanner(System.in);
          inFileName = new String("Recipes.txt");
          outFileName =  new String("ShoppingList.txt");
          recipeList =  new String[20];
          ingredients = new String[20];
          input = new String(" ");
          output = null;
          numInput = 0;
  
      }
  
      public static void main(String[] args)
      {
          RecipeList rl = new RecipeList();
          rl.run();
      }
  
      // calls all methods and prints blank lines
      public void run() 
      {
          System.out.print("\n\n\n");
          getInput();
          openRecipes();
          makeFile();
          readFile();
          output.close();
      }
  
      // gets input of recipes until 'quit' is entered
      public void getInput()
      {
          while(!input.equalsIgnoreCase("quit"))
          {
              System.out.print("Type in a recipe.Type quit to end the program--&gt; ");
              input = terminal.nextLine();
  
              if(!input.equalsIgnoreCase("quit"))
              {
                  recipeList[numInput] = input;
                  numInput++;
              }
          }
  
      }
  
      //opens RecipeList and handles exceptions 
      public void openRecipes()
      {
          File inFile = new File(inFileName);
          try
          {
              file = new Scanner(inFileName);
          }
          catch(FileNotFoundException e)
          {
              System.err.println("ERROR. Could not read/find file.");
              System.exit(1);
          }
      }
  
      // makes ShoppingList.txt and handles exceptions 
      public void makeFile()
      {
          File outFile = new File(outFileName);
  
          try
          {
              output = new PrintWriter(outFile);
          }
          catch(IOException e)
          {
              System.err.println("ERROR. Could not read/find file.");
              System.exit(2);
          }
      }
  
      public void readFile()
      {
          String directions = new String("");
  
          while(file.hasNext())
          {
              directions = file.next();
          }
  
          output.print(directions);
  
      }
  
  }
  
              ^
  </code></pre>