tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Java > IO > File System Roots

File System Roots 

The following example shows how to list the roots of file system.

File Name  :  
com/bethecoder/tutorials/io/FileSystemRoots.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.io;

import java.io.File;

public class FileSystemRoots {

  /**
   @param args
   */
  public static void main(String[] args) {
    File [] roots = File.listRoots();
    
    System.out.println("File system root listing");
    for (int i = ; i < roots.length ; i ++) {
      System.out.println(roots[i]);
    }
  }
}
   

It gives the following output,
File system root listing
C:\
D:\



 
  


  
bl  br