/*Program For File Writing In Java*/
import java.io.*;
class simple
{
public static void main(String args[])throws Exception
{
File f=new File("F:\\YOGESH (COLLEGE PROJECTS)\\sybsc");
String fnames[]=f.list();
System.out.println("NAME"+" "+"LENGTH"+" "+"STATUS"+" "+"TYPE");
for(int i=0;i<fnames.length;i++)
{
File f1=new File("F:\\YOGESH (COLLEGE PROJECTS)\\sybsc",fnames[i]);
System.out.print(" "+f1.getName());
System.out.print(" "+f1.length());
if(f1.canRead()==true)
{
System.out.print(" "+"R");
}
if(f1.canWrite()==true)
{
System.out.print(" "+"w");
}
if(f1.isFile()==true)
{
System.out.print(" "+"FILE");
}
if(f1.isDirectory()==true)
{
System.out.print(" "+"DIR");
}
System.out.println("");
}
}
}
import java.io.*;
class simple
{
public static void main(String args[])throws Exception
{
File f=new File("F:\\YOGESH (COLLEGE PROJECTS)\\sybsc");
String fnames[]=f.list();
System.out.println("NAME"+" "+"LENGTH"+" "+"STATUS"+" "+"TYPE");
for(int i=0;i<fnames.length;i++)
{
File f1=new File("F:\\YOGESH (COLLEGE PROJECTS)\\sybsc",fnames[i]);
System.out.print(" "+f1.getName());
System.out.print(" "+f1.length());
if(f1.canRead()==true)
{
System.out.print(" "+"R");
}
if(f1.canWrite()==true)
{
System.out.print(" "+"w");
}
if(f1.isFile()==true)
{
System.out.print(" "+"FILE");
}
if(f1.isDirectory()==true)
{
System.out.print(" "+"DIR");
}
System.out.println("");
}
}
}
No comments:
Post a Comment