java program to check the given file exists r not
import java.io.*;
class FileDemo
{
public static void main(String args[])
{
File f1=new
File("/java/copyright","Goutham.java");
System.out.println("file name"+f1.getName());
System.out.println("path"+f1.getPath());
System.out.println("parent"+f1.getParent());
System.out.println(f1.exists());
System.out.println(f1.canRead());
System.out.println(f1.canWrite());
System.out.println(f1.isDirectory());
System.out.println(f1.isFile());
System.out.println(f1.lastModified());
System.out.println(f1.length());
System.out.println(f1.delete());
}
}
No comments:
Post a Comment