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 ......
<%@page language="java" contentType="text/html;charset=gb2312" import="java.sql.*"%>
<jsp:useBean id="db" class="wang.connectDB"/>
< ......
我想做够购物车用session 但是不知道怎么获取购买数量 谁有具体的代码吗 希望能割舍
下面是购物车的核心代码
有了这个 就应该能够做出来吧
Java code:
public void doPost(HttpServletRequest reque ......
谁能给我一个struts2+Hibernate+Spring框架+MySql数据库
的分页代码最好是制作过程和讲解 分页代码急需
框架倒有没有分页
有struts1.2+Hibernate3.2+Spring2.0+MySQL的。
http://topic.csdn.net/u/2009101 ......
想学习下J2SE下的MVC架构。希望大家推荐点资源给我,最好有MVC实例的。
J2SE的不会
J2EE的到是知道点,你先从JSP+servlet+javaBean学习吧,掌握了之后,再学习学习struts!
引用
J2SE的不会
J2EE的 ......