我要评分
获取效率
正确性
完整性
易理解

Drive Information

Obtain the drive information from File in the Java.io package.

Example:

import Java.io.File;
import Java.io.FilenameFilter;
 
public class Disk{
public static void main(String[] args)
{
 File[] files = File. listRoots();
 for(File file:files) {
// Obtains the drive space. 
System. out.println (file+"TotalSpace: " +file.getTotalSpace() /102
4/1024/1024+"G");
 
// Obtains the available drive space. 
System. out.println (file+"UsableSpace: " +file.getUsableSpace()
/1024/1024/1024+"G");
 
// Obtains the free drive space. 
System. out.println (file+"FreeSpace: " +file.getFreeSpace() /10
24/1024/1024+"G");
            }
}