List Filesystem roots - Java File Path IO

Java examples for File Path IO:File System

Description

List Filesystem roots

Demo Code

 
  
import java.io.File;

public class Main {

  public static void main(String[] args) {

    File[] rootDirectories = File.listRoots();

    System.out.println("Available root directories in filesystem are :  ");
    for (int i = 0; i < rootDirectories.length; i++) {
      System.out.println(rootDirectories[i]);
    }/*  w w  w . j  a  v  a2  s .  co m*/
  }
}

Result


Related Tutorials