Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Worksheet – 2.3 Name : Manish Baldia Branch : CSE UID : 20BCS1221 Subject : Java lab Aim of the practical: Program to read and write data to a file. Code: import java.io.*; class Main { public static void main(String[] args) throws Exception { FileWriter fw = new FileWriter("D:\\javatest.txt"); FileReader fr = new FileReader("D:\\javatest.txt"); fw.write("Hello World!!!"); int i; while((i=fr.read())!=-1) { System.out.println((char) i); } fr.close(); fw.close(); System.out.println("Success!!!"); } } Output: