Some file operations using Java

Hello Friends, You can have a look at the below code to perform the basic file operations. Here args[0] and args[1] ,… takes file name as an input example myfile.txt.

import java.io.*;

class File1{
public static void main(String[] args) throws Exception{
    File f=new File(args[0]);
    f.createNewFile();
    System.out.println(f.length());
}

}

class File2{
public static void main(String[] args) throws Exception{
    File f=new File(args[0]);
    System.out.println(f.length());
}

}

class File3{
public static void main(String[] args) throws Exception{
    File f=new File(args[0]);
    f.delete();
}

}

class File4{
public static void main(String[] args) throws Exception{
    File f=new File(args[0]);
    System.out.println(f.isFile());
}

}
class ListFiles{
public static void main(String[] args) throws Exception{
    File f=new File(args[0]);
    String s[]=f.list();
    for(String k: s)
    {
    System.out.println(k);
    }
}
}

class ListD{
public static void main(String[] args) throws Exception{
    File f=new File(args[0]);
    File s[]=f.listRoots();
    for(File k: s)
    {
    System.out.println(k);
    }
}
}

class Ren{
    public static void main(String[] args) throws Exception{
        File f1=new File(args[0]);
       
        File f2=new File(args[1]);
       
        f1.renameTo(f2);
       
    }
}
//f.getFreeSpace() f.getTotalSpace() f.createTempFile(args[1], args[2]) f.renameTo(file2)