java数据结构
用数据结构里的递归算法怎么去从电脑上获取资源管理器里面的文件要求按树状结构输出?
Java code:
public class FindFile {
public void findFile(File f,String fileType){//f为目录文件,fileType为文件类型(后缀postfix),
File[] ff=f.listFiles();
for(File f1:ff){
if(f1.isFile()&&f1.getName().endsWith(fileType)){//文件名以什么结尾就是什么文件
System.out.println(f1);
}
if(f1.isDirectory()){
findFile(f1,fileType);
}
}
}
public static void main(String[] args){
FindFile ff=new FindFile();
ff.findFile(new File("D:\\文本文档"), ".txt");
}
}
不是树状输出,你自己调整下
谢谢 不是理想的
import java.io.File;
public class TestListFile {
private File file;
public TestListFile(String filePath) {
file = new File(filePath);
listFile(file,0);
}
public void listFile(File tmpFile,int indent) {
if(tmpFile.isFile() == true) {
printPrefix(indent);
System.out.println(tmpFile.getName());
return;
&nbs
相关问答:
不知道是什么原因,我该如何处理,请大虾们指教了,小弟在此谢过。。。。
错误信息如下:
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context t ......
package com;
import java.io.IOException;
import javax.servlet.jsp.PageContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import ......
我写了一个小程序想让机器在某一固定时间来运行它,如何实现 ??
另外顺便问一下,如果同一时刻多个Socket请求发到SERVER,Server会如何处理///??
Java code:
int numberOfMillisecon ......
想学习下J2SE下的MVC架构。希望大家推荐点资源给我,最好有MVC实例的。
J2SE的不会
J2EE的到是知道点,你先从JSP+servlet+javaBean学习吧,掌握了之后,再学习学习struts!
引用
J2SE的不会
J2EE的 ......