title: reading/writing variables from text files to variables
body: <p>I need to make a system for storing customer information and all quotations to an external file as well as entering more customers, listing customers, and the same with the quotations. As well as this I need to link all quotations/customers to an ID. I basically need to do SQL in java. However, I really need help with my input and output system, and writing all info to an array. I have got two main pieces of code but they are very inefficient and I need some suggestions, improvements or an entirely different system.
  Input from file Code:</p>
  
  <pre><code>import java.io.*; //import classes
  import java.util.ArrayList; 
  import java.util.Iterator;
  public class MyTextReader{
     public static void main(String[] args){
      String myDirectory = System.getProperty("user.dir");
      String fullDirectory = myDirectory + "\\myText.txt";
      String input_line = null;
         ArrayList&lt;String&gt; textItems = new ArrayList&lt;String&gt;(); //create array         list
      try{
          BufferedReader re = new BufferedReader(new FileReader(fullDirectory));
          while((input_line = re.readLine()) != null){
              textItems.add(input_line); //add item to array list
          }
      }catch(Exception ex){
             System.out.println("Error: " + ex);
      }
         Iterator myIteration = textItems.iterator(); //use Iterator to cycle list
         while(myIteration.hasNext()){ //while items exist
           System.out.println(myIteration.next()); //print item to command-line
         }
     }    
  }
  </code></pre>
  
  <p>Output to File</p>
  
  <pre><code>import java.io.FileWriter; //import classes
  import java.io.PrintWriter;
  public class MyTextWriter{
      public static void main(String[] args){
          FileWriter writeObj; //declare variables (uninstantiated)
          PrintWriter printObj;
               String myText = "Hello Text file"; 
          try{ //risky behaviour – catch any errors
                  writeObj = new FileWriter("C:\\Documents\\myText.txt" , true);
             printObj = new PrintWriter(writeObj);//create both objects
             printObj.println(myText);  //print to file
             printObj.close(); //close stream
            }catch(Exception ex){
         System.out.println("Error: " + ex);
            }     
      }   
  }
  </code></pre>