Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,18 @@
|
|||
import java.io.File;
|
||||
public class FileExistsTest {
|
||||
public static boolean isFileExists(String filename) {
|
||||
boolean exists = new File(filename).exists();
|
||||
return exists;
|
||||
}
|
||||
public static void test(String type, String filename) {
|
||||
System.out.println("The following " + type + " called " + filename +
|
||||
(isFileExists(filename) ? " exists." : " not exists.")
|
||||
);
|
||||
}
|
||||
public static void main(String args[]) {
|
||||
test("file", "input.txt");
|
||||
test("file", File.separator + "input.txt");
|
||||
test("directory", "docs");
|
||||
test("directory", File.separator + "docs" + File.separator);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue