Java通過IO流輸出文件目錄的實(shí)例代碼
//通過IO流輸出文件目錄,不同級的目錄之間用*間隔
package com.fjnu.io;import java.io.File;public class dicOut { public static void main(String[] args) { File file = new File('E:23287Desktopfile大三上'); printDic(file, 0); } public static void printDic(File file, int flag){ flag++; if(file.isFile()){ for(int i = 1; i < flag; i++){System.out.print('*'); } System.out.println(file.getName()); }else{ for(int i = 1; i < flag; i++){System.out.print('*'); } System.out.println(file.getName()); File[] files = file.listFiles(); for(File f : files){printDic(f,flag); } } }}
到此這篇關(guān)于Java通過IO流輸出文件目錄的文章就介紹到這了,更多相關(guān)Java 輸出文件目錄內(nèi)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. Android 實(shí)現(xiàn)徹底退出自己APP 并殺掉所有相關(guān)的進(jìn)程2. Vue實(shí)現(xiàn)仿iPhone懸浮球的示例代碼3. vue使用moment如何將時(shí)間戳轉(zhuǎn)為標(biāo)準(zhǔn)日期時(shí)間格式4. 一個(gè) 2 年 Android 開發(fā)者的 18 條忠告5. js select支持手動(dòng)輸入功能實(shí)現(xiàn)代碼6. Spring的異常重試框架Spring Retry簡單配置操作7. Android studio 解決logcat無過濾工具欄的操作8. 什么是Python變量作用域9. PHP正則表達(dá)式函數(shù)preg_replace用法實(shí)例分析10. vue-drag-chart 拖動(dòng)/縮放圖表組件的實(shí)例代碼
