import
java.io.File;
class
apples{
public
static
void
main(String[] args){
File
x =
new
File("C:\\java\\abc.txt");
→必須是\\
if(x.exists())
System.out.println(x.getName()
+ "
exist!");
else
System.out.println("this
things doesn't exists!");
}
}
檢查它存在與否:
this
things doesn't exists!
沒有留言:
張貼留言