|
File System Roots
The following example shows how to list the roots of file system.
|
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 = 0 ; i < roots.length ; i ++) {
System.out.println(roots[i]);
}
}
}
|
| |
It gives the following output,
File system root listing
C:\
D:\
|
|