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

查看所有标签

XMPP

XMPP

Peter Saint-Andre、Kevin Smith、Remko TronCon / O'Reilly Media / 2009-5-4 / USD 39.99

This practical book provides everything you need to know about the Extensible Messaging and Presence Protocol (XMPP). This open technology for real-time communication is used in many diverse applicati......一起来看看 《XMPP》 这本书的介绍吧!

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

在线压缩/解压 JS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器