Files Property in Java Program
Files Property
import java.io.*;
class Fileproperty
{
public Static void main(String args[]) throws IOException
{
File f1=new File("c:/AppletEg.java");
if(f1.exists())
{
System.out.println("Name:"+f1.getname()+"\n"+"path:"+f1.getpath(\);
System.out.println(f1.iSFile()?"file exists":"not exists");
System.out.println(f1.iSDirectory()?"Directory exists":"not exists");
System.out.println(f1.canRead()?"It was aread only file:":"not a read");
System.out.println(f1.can write()?"File Exists");
System.out.println(f1.isHidden()?"Hidden file":"not a hidden file");
}
else
{
System.out.println("The required file was not found");
}
}
}
0 coment�rios:
Post a Comment