3, ఏప్రిల్ 2012, మంగళవారం

THIS CODE LET U KNOW THE FILE PROPERTIES WHICH WOULD HAVE SUPPLIED FROM THE COMMAND PROMPT


import java.io.*;
class fileattributes
{
public static void main(String s[])
{
File f=new File(s[0]);
String ex=f.exists()?"yes":"no";
String re=f.canRead()?"yes":"no";
String wr=f.canWrite()?"yes":"no";
String fi=f.isFile()?"yes":"no";
String di=f.isDirectory()?"yes":"no";

System.out.println("the file attributes are");
System.out.println("exists"+ex);
if(f.exists())
{
System.out.println("readable\t"+re);
System.out.println("writeable\t"+wr);
System.out.println("is a file\t"+fi);
System.out.println("is a directory\t"+di);
}}}

కామెంట్‌లు లేవు:

కామెంట్‌ను పోస్ట్ చేయండి