title: BufferedWriter without try method IOException
body: <p>I know this topic has been discussed a lot and I have already read a lot of posts here about that, but I still seem to have trouble.</p>
  
  <p>My problem is that I am also a beginner and I don't really understand how ĸwork and the try and catch function.</p>
  
  <p>I have been trying to write to a file some string array, but it doesn't appear in there, nor the catch error is displayed in the console. I don't want to use the try method in this case, because when I am, I cannot use the variable declared for let's say BufferedWriter in other places, I am only restricted to the try method. Otherwise, I get a bug.</p>
  
  <p>This is my code:</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  import java.lang.*;
  public class FileWrit  {
  
      public static void main (String[] args){
          try(BufferedWriter writer = new BufferedWriter(new FileWriter("testing.txt"))) {
              String[] anything = new String[3];
              writer.write("anything");
              anything[0] = "case1";
              anything[1] = "This is 1.5";
              anything[2] = "Case 3, i do not know how to count";
              for(String mem: anything) {
                  writer.append(mem);
              }
              writer.close();
          } catch(IOException e) {
              System.err.println("Idk when should this appear?");
          }
      }
  }
  </code></pre>