boolean isDirectory()
Tests whether the file denoted by this abstract pathname is a directory.
boolean isFile()
Tests whether the file denoted by this abstract pathname is a normal file.
Tests whether the file denoted by this abstract pathname is a directory.
boolean isFile()
Tests whether the file denoted by this abstract pathname is a normal file.
如:if((new File("C:\dos")).exists()){ //如果存在c:\dos
......
}
if((new File("C:\\dos")).exists()){ //如果存在c:\dos
......
}
if((new File("C:/dos")).exists()){ //如果存在c:\dos
......
}