Untitled
unknown
java
a year ago
698 B
3
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