/** * Summary of readers/writers: * * import java.io.*; * * 1. Reading from a file * * BufferedReader br = * new BufferedReader(new FileReader("filename.txt")); * * br.readLine(); // returns the next line of the file * // or null if the end of file is reached * * 2. Writing to a file * * PrintStream p = * new PrintStream(new FileOutputStream("filename.txt")); * * p.print("Text to put in file"); * p.println("More text to put in the file."); * * 3. Reading from System.in (command prompt/terminal) * * BufferedReader br = * new BufferedReader(new InputStreamReader(System.in)); * * br.readLine(); // returns the next text typed in the * // command prompt or null if nothing has * // been typed * * 4. Writing to System.out * * System.out.print(); * System.out.println(); */