import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
public class NewClass {
public static void main(String[] args) throws IOException {
byte i = 1;
File file = new File("F:\\test.txt");
System.out.println(file.isFile());
FileWriter out = new FileWriter(file);
while (i <= 100) {
if (i % 3 == 0 || i % 7 == 0) {
out.write(i + ",");
}
i++;
}
out.close();
}
}
亲测有效