我要输出之多个文件,代码如下,但是为什么文件生成了,但是里面却没有内容?谢谢!
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class test {
public static void main(String args[])throws Exception{
String[] filename = new String[101];
for (int n = 0;n<101;n++)
{
filename[n]="src/Testvec" + n + ".txt";
java.io.File testvec = new File(filename[n]);
java.io.PrintWriter testout = new PrintWriter(testvec);
testout.print("The weather is good!");
}
}
} |