title: Is it good idea to create two different files for reading and writing?
body: <p>I am building a basic bank application, although the usage of the java language is intermediate level.
  There I am using file input and output a lots. Along the way some questions has popped up in my mind about the <code>file-i/o</code> in java.</p>
  
  <p>1) What if I create two different text file for writing and reading objects? Does it make any difference?</p>
  
  <p>2) How about the specifying path (or giving file name), what if I use <code>//</code> instead of <code>\\</code>?</p>
  
  <p>3) Do I necessarily need to create a new file object like this: <code>File file=new File("C://Users//Documents//NetBeansProjects//BankFile_assignment.txt");</code> in my specific case?</p>
  
  <p>Last but not least if you may wonder about my file-i/o class: </p>
  
  <pre><code>    public class ReaderWriter {
  
      public void writeToFile(List&lt;BankAccount&gt; accounts) {
          try {
              File file = new File("C://Users//Documents//NetBeansProjects//BankFile_assignment.txt");
              FileOutputStream fos = new FileOutputStream(file);
              ObjectOutputStream oos = new ObjectOutputStream(fos);
              oos.writeObject(accounts);//take the arrayList 
              oos.flush();
              oos.close();
              fos.close();
  
          } catch (Exception e) {
              e.printStackTrace();
          }
      }
  
      public List&lt;BankAccount&gt; readFromFile() {
          List&lt;BankAccount&gt; readData = null;
          try {
              File file = new File("C://Users//Documents//NetBeansProjects//BankFile_assignment.txt");
              FileInputStream fis = new FileInputStream(file);
              ObjectInputStream ois = new ObjectInputStream(fis);
              readData = (List&lt;BankAccount&gt;) ois.readObject();
  
              ois.close();
              fis.close();
          } catch (Exception e) {
              e.printStackTrace();
          }
  
          return readData;
  
      }
  }
  </code></pre>