title: Accessing variable inside try catch
body: <p>I keep getting a compile error on the return menuFont line it says there is no variable menuFont. Could someone please tell how to fix this.</p>
  
  <pre><code>import java.awt.Font;
  import java.awt.FontFormatException;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  
  
  public class loadFiles {
  Font getFont(){
              try {
                  Font menuFont = Font.createFont( Font.TRUETYPE_FONT, new FileInputStream("font.ttf"));
  
              } catch (FileNotFoundException e) {
                  System.out.println("Cant find file.");
                  e.printStackTrace();
              } catch (FontFormatException e) {
                  System.out.println("Wrong file type.");
                  e.printStackTrace();
              } catch (IOException e) {
                  System.out.println("Unknown error.");
                  e.printStackTrace();
              }
              return menuFont;
      }
  }
  </code></pre>