电脑运行java文件路径_java文件路径问题
展开全部
/**
* 关于文件的读写,总是会出现(系统找不到指定的文件。)
* @author Jr
*
*/
public class IOClass {
public static void main(String[] args) throws IOException {
62616964757a686964616fe58685e5aeb931333330323937
File in = new File(“d:\\System32\\input.in”);
Scanner s = new Scanner(in);
int a = s.nextInt();
System.out.println(a);
int b = s.nextInt();
System.out.println(b);
File fout = new File(“d:\\System32\\output.out”);// new File,怎么说呢,应该说只是在内存中new了一个,还并没有写到硬盘上去呢
fout.createNewFile();// 你的系统找不到指定文件,是不是因为你没有创建这个文件
PrintWriter out = new PrintWriter(fout);
out.println(a+b);
in.delete();
out.close();
}
}
还没有评论,来说两句吧...