In this section, you will learn how to list out all the drives available in the system.
Description of code:
To get the list of drives, we have called the method listRoots() of File class. This will return an array of File objects for the drives that are available in the system.
Here is the code:
Above code will print all the drives available in the system. With the help of above code you can find the drives attached to your system.