i understand how to print into a file but don't understand how to allow the user to input text so that it stores in the text file.
import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; /** * Demonstrates how to append text to a file using Java. * (Just add a "true" boolean parameter when creating the FileWriter.) * Created by Alvin Alexander, [url=http://devdaily.com]devdaily.com | tutorials for java, linux, mac os x, iphone, ipad, uml, quality, testing[/url]. */ public class reservation { public static void main(String[] args) { PrintWriter pw = null; try { // created as a separate variable to emphasize that I'm appending to this file boolean append = true; pw = new PrintWriter(new FileWriter(new File("output.txt"), append)); // a print writer gives you many more methods to write with pw.println("Hello, World"); } catch (IOException e) { e.printStackTrace(); // deal with the exception } finally { pw.close(); } } }