Java Java File.getFreeSpace()
方法具有以下语法。
public long getFreeSpace()
示例
在下面的代码显示如何使用File.getFreeSpace()
方法。
import java.io.File;
public class Main {
public static void main(String[] args) throws Exception {
// create new files //::W W w. y I iBAI.C O M
File f = new File("c:/");
long size = f.getFreeSpace();
System.out.print(size);
}
}
上面代码执行结果如下 -
9405091840