Strings , I/O and formatting (Part-5 File I/O)

Let's start coding on what we have learnt in the previous post. File f=new File("me.txt"); System.out.println(f.exists()); Here we created a File object and checked for the presence of the file using f.exists() method.If you don't have a me.txt inside the project folder this gives false as the output and if you do have true as the output.Let's move on and create a new file. boolean a = f.createNewFile(); System.out.println(a+" "+f.exists()); Here we created a new file and check whether the process is successfully finished and the file is created.Note that createNewFile() creates a new file if it doesn't already exists.If the file exists you get false as the output from the above method. One thing to remember is that you have to put the file operation codes inside a try catch block as the operations declare checked exceptions.Alright...!!now we'll start writing text to files. File f=new File("me.txt"); FileWriter...