Java 实例 - 查看系统根目录

Java 教程 · 2019-02-11 08:44:26

以下实例演示了使用 File 类的 listRoots() 方法来输出系统所有根目录:

Main.java 文件

import java.io.*; class Main{ public static void main(String[] args){ File[] roots = File.listRoots(); System.out.println("系统所有根目录:"); for (int i=0; i < roots.length; i++) { System.out.println(roots[i].toString()); } } }

以上代码运行输出结果为:

系统所有根目录:
C:\
D:\
E:\
F:\
G:\
H:\

点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html

查看所有标签

Ajax Design Patterns

Ajax Design Patterns

Michael Mahemoff / O'Reilly Media / 2006-06-29 / USD 44.99

Ajax, or Asynchronous JavaScript and XML, exploded onto the scene in the spring of 2005 and remains the hottest story among web developers. With its rich combination of technologies, Ajax provides a s......一起来看看 《Ajax Design Patterns》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具