Answer the question
In order to leave comments, you need to log in
How to get from an array of disks File.listRoots() the one you need in Java?
Hello. I am writing my program in Java. There is code below:
package com.technicalkeeda;
import java.io.File;
public class App {
public static void main(String[] args) {
File[] roots = File.listRoots();
System.out.println("List of available filesystem roots:- ");
for (File root: roots) {
System.out.println(root);
}
}
}
List of available filesystem roots:-
C:\
D:\
E:\
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question