title: How do you write multiple variables to a text file?
body: <p>I'm a beginner programmer and i have a question about iostreams.
  Recently i learned how to write a string or a variable to a textfile with PrintWriter. Now i'm creating a small program but i need to output multiple variables. Do i need to create a different file for every variable or can i just output all my variables to one textfile? If so, how do i read them back into my program.</p>
  
  <pre><code>//write
  static File data = new File ("data.txt");
  static PrintWriter outputStream = new PrintWriter(data);
  outputStream .println("test");
  outputStream .close();
  
  //read
  Scanner inputStream = new Scanner(data);
  String test = input.nextLine();
  </code></pre>