JAVA
Java | IO| FileWriter |example
Java.io.FileWriter
An Example of FileWriter in Java
how is a file writer implemented in java?/ / Copy the code from textarea below
package venu.darur.gopal.examples.java.IO.FileWriter; import java.io.FileWriter; import java.io.IOException; public class FileWriterDemo { public static void main ( String [] args ){ String fileWriterString= "C:\\FIleWRITER.TXT"; FileWriter fileWriter =null; try{ fileWriter= new FileWriter( fileWriterString, true ); // true for appending text String abc = "HELLO WORLD"; fileWriter.write(abc); }catch (IOException eIOException) { System.out.println( "IOEXCEPTION IN READING THE FILE" + eIOException); }finally{ try{ if( fileWriter!=null ){ fileWriter.close(); } }catch (IOException eIOException) { System.out.println( "IOEXCEPTION IN READING THE FILE" + eIOException); } } }
Please send comments to
vgdarur.javafive@blogger.com
Copyright © 2008 - iForeRunner.com