title: Saving/retrieving usernames and passwords in java text file
body: <p>I am trying to save a list of usernames and passwords the user enters in one text file. It should look something like this:
  <code>
      admin#admin
      bob#123456
      username#pass
  </code>(theses are supposed to be on new lines)
  The part before the sharp(#) is the username and the after being the password. </p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>String path;
  private boolean append_to_file = false;
  
  public void writeToFile(String username, String password) throw IOExection{
       FileWriter write = new FileWriter(path, append_to_file);
       PrintWriter print_line = new PrintWriter(write);
  
       print_line.printf("%s" + "%n", username + "#" + password);
       print_line.close();
  }
  </code></pre>
  
  <p>I know that people are going to say use a database, but i need to do it this way for this assingment. And when I want to retrieve a username and the corresponding password how will i do so? </p>