Java IO Tutorial - Java File.getTotalSpace()








Syntax

File.getTotalSpace() has the following syntax.

public long getTotalSpace()

Example

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

/* w  ww  . j av a  2 s  .  co  m*/
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.getTotalSpace());

  }
}

The code above generates the following result.