File I/O: Reading from one file and writing to another (Java)

前端 未结 5 1191
闹比i
闹比i 2021-01-05 02:36

I\'m currently working on a lab in my cpe class and we have to create a simple program that scans in strings from a .txt file and prints them to a different .txt file. So fa

5条回答
  •  死守一世寂寞
    2021-01-05 03:04

    You need to figure out where it looks for the "input" file. When you just specify "input" it looks for the file in the current working directory. When working with an IDE, this directory may not be what you think it is.

    Try the following:

    System.out.println(new File("input").getAbsolutePath());
    

    to see where it looks for the file.

提交回复
热议问题