Untitled
unknown
java
2 years ago
698 B
8
Indexable
import java.io.*;
import java.util.Scanner;
public class FileHandle
{
public static void main(String[] args)
{
try
{
File f = new File("test.txt");
Scanner s = new Scanner(f);
String con = " ";
while(s.hasNextLine())
con += s.nextLine();
FileWriter fw = new FileWriter("nfile.txt");
fw.write(con);
fw.close();
System.out.println("File Writter");
}
catch(IOException e)
{
System.out.println("file not found");
}
finally
{
System.out.println("file is successfully read");
}
}
}Editor is loading...
Leave a Comment