Retrieving Drive Names

Retrieving Drive Names

To retrieve drive names from a system, use the static method listRoots in package. It will return the all-available drive present in the system. This method will be useful when customizing applications to perform Input Output operations. The listRoots method returns an array of File Objects.

 import;class Drive{        static void main(String[]arr)        {               File[]f=File.listRoots();               for(int i=0;i



Share the Post: