line-by-line so once again here is the exact same function we're only four tat open a file for reading so this has our buffered reader a stop in a little while loop and keeps asking for file names in tilbury the file so it's exactly the same code word is reusing the car that's part of the beauty of quote renewed strength what we're going to do here is we're going to be open a file by asking the user to enter a file name and this is the file that's going to be our reader sonar objects rd now we're going to create a file that is a rem_ object which is writer so we're going to tried 'cause we're going to be something dangerous creating a file is just as dangerous or writing apologized is dangerous is reading one as a matter of fact in some sense anymore esoteric weight is more dangerous why is it more dangerous because if you try to tell the computer rights will file which already exists what's it going to do you might say it will i tell you that already exists would try to give you a different file name no it'll go smash the file that exists there it's a bit and write a brand new file which means the after overwriting students dot text not a big deal if you're over writing your word processor big deal be careful what file names you get when you are writing because if al farming already exists it will get rid of the one that's already there and overwrite it with a new one which is what ever you happen to right into it so print writer we're gonna create a new writer and we want to inside a print writer just like we had this little thingy up here where we had it buffered reader a buffer reader had used a file reader over here one critique print writer and this is all chapter called the books they don't need to worry about scribbling this down quickly a prick writer use a new file writer is the object you create and passed to a preparator and you give it a file napier out you could have given it you know like a string variable or whatever here i've just put in directly copy dot text of thing i'm going to create is a file called copy dot text all your files need to be in the same project as your coat so that's where you files will get created that's where we're now looks to read a file that's worth a look at that same father as your project so i have a while truly when i'm writing to do on my wall truman i'm going to read one line at a time from mike input file from my reader if my reader has no more lines i get in on i say i'm done reading i'm going to break out of the loop if i'm not done reading i've just gotten a line i'm going to write that line to the screen using print lynn separately without any object over here rights to the console because the separate lim is being called on the console program in their rights the consul when i do w r dot print lynn that sending print len to the right are right the print writer object and it's writing off the line so it's saying here is the swine hey plane writer write this out to the file that you correspond to its assault they'll go right in copy dot tech and i keep looking like this i get a new line if it's not that end of the file then i writes the screen and i write if the file if i go through this whole while loop and finish off everything so i finished the whole file i get to airline equals null i say hey i'm done reading the file so close the file to read also done a writing the file so i tell those writing file the print writer at the close itself and this whole time if something bad happens and i get an exception i catch the acceptance a i don't know what to do with it who is going to throw to someone else and that's the whole program that's all the coding each copy fossa let's run this and just make sure it actually works operation progress and just to show you that i'm not mine when he cancels for a second to will open up some folders notice no copy dot text in here here's the little project file that i have there's my copy file class my copy file dot java file here's my stevens dot text file no copy dot text file now magic rerun satsang packages to united and heidi had typed up the copy dot dot com did you get to do running and running and running i'll come on you can do it and you're going to live i love the glowing blue it's fun copy file please enter fouling students dot text i'll spare you the uh... the incorrect file names so it's copied says copping line there right at all these lines to the screen 