java4all@1986 java. Powered by Blogger.

Use FileWriter to write an array of strings to a file.

>> Monday, May 23, 2011

import java.io.FileWriter;

public class Main {
public static void main(String[] argv) throws Exception {
FileWriter fw = new FileWriter("file.dat");
String strs[] = { "com", "exe", "doc" };

for (int i = 0; i < strs.length; i++) {
fw.write(strs[i] + "\n");
}
fw.close();
}
}

0 comments:

Post a Comment

FaceBook Login

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

HTML/JAVASCRIPT

Total Pageviews

STATCOUNTER

  © Blogger template Simple n' Sweet by Ourblogtemplates.com 2009

Back to TOP