|
||
|
||||
|
Java Code
import java.io.*;
public class WriteFile {
public static void main(String[] args) throws IOException {
Writer output = null;
File file = new File("myFile.txt");
output = new BufferedWriter(new FileWriter(file));
output.write("Whatever string you want here");
output.close();
System.out.println("File written");
}
}
__________________
Don't forget to add syntax highlighted code tags around your code: [highlight=Java] code here [/highlight] Forum Tip: Add to peoples reputation ( ) by clicking the button on their useful posts.
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Write a simple XMPP (Jabber) client using the Smack API | JavaPF | Java Code Snippets and Tutorials | 20 | 16-07-2010 05:05 AM |
| How to Rename a file with Java | JavaPF | Java Code Snippets and Tutorials | 0 | 19-05-2008 11:52 AM |