title: FileWriter issue - unreported IOEXception which must be caught
body: <p>I've encountered an issue in Java trying to write to a file using FileWriter. Simply declaring <code>FileWriter writer = new FileWriter("filelocation");</code> yields that there is an unreported IOException which must be caught.</p>
  
  <p>To rectify this, naturally I put my FileWriter within a try-catch block, but that causes an issue with scope. To fix this, I tried declaring the FileWriter before the try catch block and assigning the location within the try catch. After the try catch block when I would like to use the FileWriter, it tells me it may not have been initialized. I'm not certain how else to handle this, and never encountered this issue in Java 1.7 or likewise.</p>
  
  <p>This is an example of my final situation in case I was unclear;</p>
  
  <pre><code>Scanner userInput = new Scanner(System.in);
  FileWriter writer;
  try {
      System.out.println("Enter the file directory you would like to store in");
      String fileLocation = userInput.nextLine();
      writer = new FileWriter(fileLocation);
  } catch(java.io.IOException e) {
      System.out.println("Error message");
  }
  writer.write("Stuff"); //writer may not have been initialized
  </code></pre>