电脑运行java文件路径_java文件路径问题

朴灿烈づ我的快乐病毒、 2022-11-06 09:53 236阅读 0赞

展开全部

/**

* 关于文件的读写,总是会出现(系统找不到指定的文件。)

* @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();

}

}

2629d04ee618f509dbfc5e92496f2481.png

发表评论

表情:
评论列表 (有 0 条评论,236人围观)

还没有评论,来说两句吧...

相关阅读