Create text file and write data with java :
/*
* www.developerpages.gr
* Create text file and write data
*/
package writetofile;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
public class WriteToFile {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
FileWriter outFile;
try {
outFile = new FileWriter("test.txt");
PrintWriter out = new PrintWriter(outFile);
out.println("www.developerpages.gr");
out.println("---------------------");
out.println("write Test data into text file ");
out.close();
} catch (IOException ex) {
Logger.getLogger(WriteToFile.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Original Article : http://developerpages.gr/index.php/el/desktop-development-2/java/54-write-data-to-text-file-with-java
/*
* www.developerpages.gr
* Create text file and write data
*/
package writetofile;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Level;
import java.util.logging.Logger;
public class WriteToFile {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
FileWriter outFile;
try {
outFile = new FileWriter("test.txt");
PrintWriter out = new PrintWriter(outFile);
out.println("www.developerpages.gr");
out.println("---------------------");
out.println("write Test data into text file ");
out.close();
} catch (IOException ex) {
Logger.getLogger(WriteToFile.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Original Article : http://developerpages.gr/index.php/el/desktop-development-2/java/54-write-data-to-text-file-with-java
No comments:
Post a Comment