title: What's the difference between File and FileLoader in Java?
body: <p>So I have the following code where I should read a Text File (This is just the Main Class):</p>
  
  <pre><code>import gui.MenuWindow;
  import java.io.IOException;
  import javax.swing.JOptionPane;
  
  public class Assessor {
  
      public static void main(String args[]) throws IOException {
  
          FileLoader file = new FileLoader("Example.txt");
          try{
              new MenuWindow(file.loader());
          } catch(Exception exc) {
              JOptionPane.showMessageDialog(null, "Error Reading File");
          }
      }
  }
  </code></pre>
  
  <p>Then I'd have to load the Text into a ListBox using Swing. The thing is that I've found this new code to read a Text File:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.File;
  import java.io.FileReader;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  
  public class ReadTextFileExample {
      public static void main(String[] args) {
          File file = new File("test.txt");
          StringBuffer contents = new StringBuffer();
          BufferedReader reader = null;
  
          try {
              reader = new BufferedReader(new FileReader(file));
              String text = null;
  
              // repeat until all lines is read
              while ((text = reader.readLine()) != null) {
                  contents.append(text)
                      .append(System.getProperty(
                          "line.separator"));
              }
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          } finally {
              try {
                  if (reader != null) {
                      reader.close();
                  }
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
  
          // show file contents here
          System.out.println(contents.toString());
      }
  }
  </code></pre>
  
  <p>So I'd like to know what is the difference between the following two lines:</p>
  
  <pre><code>FileLoader file = new FileLoader("Example.txt"); //First Code
  
  File file = new File("test.txt"); //Second Code
  </code></pre>
  
  <p>And... What's the <code>StringBuffer</code> and <code>BufferedReader</code> used to? Thanks!</p>