当前位置: 技术问答>java相关
死也调不出结果,总提示系统找不到指定路径,怎么回事啊?
来源: 互联网 发布时间:2015-06-28
本文导语: import java.io.*; import java.util.*; public class WriteCharacters{ public static void main(String[] args){ try{ String dirName="c:/JunkData"; String fileName="Proverbs.txt"; File output=new File(dirName,fileName); ...
import java.io.*;
import java.util.*;
public class WriteCharacters{
public static void main(String[] args){
try{
String dirName="c:/JunkData";
String fileName="Proverbs.txt";
File output=new File(dirName,fileName);
output.mkdir();
output.createNewFile();
if(!output.isFile()){
System.out.println("Creating"+output.getPath()
+"failed.");
return;
}
BufferedWriter out=new BufferedWriter(
new FileWriter(output.getPath(),true));
String[] sayings={
"indecision maximixes fiexibility.",
"only the mediocre are always at their best.",
"a little knowledge is a dangerous thing.",
"Many a mickle makes a muckle.",
"Who knows most says least.",
"A wise man sits on the hole in his carpet."
};
for(int i=0;i
import java.util.*;
public class WriteCharacters{
public static void main(String[] args){
try{
String dirName="c:/JunkData";
String fileName="Proverbs.txt";
File output=new File(dirName,fileName);
output.mkdir();
output.createNewFile();
if(!output.isFile()){
System.out.println("Creating"+output.getPath()
+"failed.");
return;
}
BufferedWriter out=new BufferedWriter(
new FileWriter(output.getPath(),true));
String[] sayings={
"indecision maximixes fiexibility.",
"only the mediocre are always at their best.",
"a little knowledge is a dangerous thing.",
"Many a mickle makes a muckle.",
"Who knows most says least.",
"A wise man sits on the hole in his carpet."
};
for(int i=0;i