CODING:
import java.io.*;
public class file3 {
public static void main(String[] args)throws IOException {
File f=new File("New Folder");
if(f.exists())
{
System.out.println("File already exists");
}
else{
f.mkdir();
System.out.println("New Folder Created");
}
System.out.println("Lenght "+f.length());
System.out.println("Last Modify Time "+f.lastModified());
System.out.println("Can Read "+f.canRead());
System.out.println("Can Write "+f.canRead());
System.out.println("Can Excute "+f.canExecute());
System.out.println("Is Hidden "+f.isHidden());
System.out.println("Is File "+f.isFile());
System.out.println("Is Directory "+f.isDirectory());
String name[]=f.list();
System.out.println("Folder Contant ARE ");
for(String temp : name){
System.out.println(temp);
}
System.out.println("List Files ");
File f1[]=f.listFiles();
for(File temp : f1){
System.out.println(temp);
}
System.out.println("Name "+f.getName());
System.out.println("Path "+f.getPath());
System.out.println("Absoulate Path "+ f.getAbsolutePath());
}
}
public class file3 {
public static void main(String[] args)throws IOException {
File f=new File("New Folder");
if(f.exists())
{
System.out.println("File already exists");
}
else{
f.mkdir();
System.out.println("New Folder Created");
}
System.out.println("Lenght "+f.length());
System.out.println("Last Modify Time "+f.lastModified());
System.out.println("Can Read "+f.canRead());
System.out.println("Can Write "+f.canRead());
System.out.println("Can Excute "+f.canExecute());
System.out.println("Is Hidden "+f.isHidden());
System.out.println("Is File "+f.isFile());
System.out.println("Is Directory "+f.isDirectory());
String name[]=f.list();
System.out.println("Folder Contant ARE ");
for(String temp : name){
System.out.println(temp);
}
System.out.println("List Files ");
File f1[]=f.listFiles();
for(File temp : f1){
System.out.println(temp);
}
System.out.println("Name "+f.getName());
System.out.println("Path "+f.getPath());
System.out.println("Absoulate Path "+ f.getAbsolutePath());
}
}
Comments
Post a Comment