import java.io.*;

public class fileIO
{
	public static void main(String[] args)
	{
		try   //used in conjunction with catch
		{
			BufferedWriter buff = new BufferedWriter(new FileWriter("out.txt"));  //writes to a file
			buff.write("Hello CSI 203");                                          //text to write
			buff.newLine();                                                       //makes a new line based on the type of file's code for a new line
			buff.write("It's 1:35 in the morning and I want to go to sleep");
			buff.close();  //calls buff.flush() 
			
			BufferedReader buff2 = new BufferedReader(new FileReader("in.project"));  //reads from a file (doesn't have to be text)
			String fromFile = buff2.readLine();                                   //sets a string equal to the first line of a file
			System.out.println(fromFile);
		}
		catch (IOException e)  //detects if an exception is returned from line 9
		{
			e.printStackTrace();
		}
		
		
	}
}
