0

Why input file not found ?

File InputFile1 = new File("output.in.txt"); if (!InputFile1.exists()) { System.out.println("Input File not Found !!"); System.exit(0); }else if (InputFile1.exists()) { System.out.println("found"); }

18th Oct 2020, 2:39 AM
SH S
SH S - avatar
1 Odpowiedź
0
because new File is just an object for store infomation about a file, not the file itself. public static void main(String[] args) throws IOException { File InputFile1 = new File("output.in.txt"); InputFile1.createNewFile(); https://code.sololearn.com/cZ1Xc38SjXKK/#java
18th Oct 2020, 8:08 AM
zemiak