CODING:
import java.io.*;
public class filemain {
public static void main(String[] args)throws IOException {
File f=new File("demo.txt");
FileWriter w=new FileWriter(f);
w.write("Hello Kartik");
w.close();
FileReader r=new FileReader(f);
int ch=0;
while((ch=r.read())!=-1){
System.out.println((char)ch);
}
System.out.println("Exit");
}
}
public class filemain {
public static void main(String[] args)throws IOException {
File f=new File("demo.txt");
FileWriter w=new FileWriter(f);
w.write("Hello Kartik");
w.close();
FileReader r=new FileReader(f);
int ch=0;
while((ch=r.read())!=-1){
System.out.println((char)ch);
}
System.out.println("Exit");
}
}
Comments
Post a Comment