Java File.getUsableSpace()

Syntax

File.getUsableSpace() has the following syntax.

public long getUsableSpace()

Example

In the following code shows how to use File.getUsableSpace() method.


/*from  ww w  .  j av a  2  s  .c om*/

import java.io.File;

public class Main {
  public static void main(String[] args) throws Exception {

    // create new files
    File f = new File("c:/");


    System.out.print(f.getUsableSpace());

  }
}

The code above generates the following result.