import java.io.*;
class FileInformation
{
public static void main(String[] args) throws IOException
{
File f=new File("Demo.txt");
if(f.exists())
{
System.out.println("file exists");
}
if(f.canRead())
{
System.out.println("File is readable");
}
if(f.canWrite())
{
System.out.println("File is writable");
}
if(f.isFile())
{
System.out.println("It is a file");
}
long fl=f.length();
System.out.println("The length of the file is "+fl+" bytes");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: