List drives
This piece of code might come in handy on a Windows platform to list the drives of a computer. |
import java.io.File; public class FileUtil { public void listDrives() { File[] drives = File.listRoots(); for (int i = 0; i < drives.length; i++) { System.out.println(drives[i]); } } public static void main(String[] args) { FileUtil fileutil = new FileUtil(); fileutil.listDrives(); } } |
| Do you know your Java? | |
| Take a Ten-Question-Java-Quiz! | |
Bookmark:
Search for code examples on this site
