Mega Code Archive

 
Categories / Java Tutorial / File
 

Using PrintWriter

import java.io.IOException; import java.io.PrintWriter; public class MainClass {   public static void main(String[] args) {     try {       PrintWriter pw = new PrintWriter("c:\\temp\\printWriterOutput.txt");       pw.println("PrintWriter is easy to use.");       pw.println(1234);       pw.close();     } catch (IOException e) {     }   } }