分类：电脑/网络-程序设计-JAVA相关
问题：java如何能够从屏幕显示复制到一个文件里mport.*;pub 
mport  .*;puic class Test{static int tot;public static void main(String []args){Test fileTest = new Test();try{String path = args[0];File file = new File(path); Dir(file);String total = "文件数是 :"+tot; intln(total);}catch(Exception err){}}public void doDir (File fimport  .*;puic class Test{static int tot;public static void main(String []args){Test fileTest = new Test();try{String path = args[0];File file = new File(path); Dir(file);String total = "文件数是 :"+tot; intln(total);}catch(Exception err){}}public void doDir (File file){try{File []files =  stFiles();for(int i=0; i<files.length;i++){if(files[i].isDirectory()){doDir(files[i]);}else{doFile(files[i]);tot++;}}}catch(Exception error){}}public void doFile(File file){String path =  tPath(); intln(path);}}怎样才能把显示的目录复制到一个文件里!想不出来了 希望 能得到帮助 谢谢了
回答：import  .PrintWrer;import  .File;import  .FileOutputStream;public class Test {  static int tot;  static PrintWriter out = null;  public static void main(String[] args) {    Test fileTest = new Test();    try {      String path = args[0];      File file = new File(path);      String filePath =  tAbsolutePath() + "\\list.txt";      FileOutputStream outstream = new FileOutputStream(filePath);      out = new PrintWriter(outstream);       Dir(file);       ose();       ose();      String total = "文件数是 :" + tot;       intln(total);    } catch (Exception err) {    }  }  public void doDir(File file) {    try {      File[] files =  stFiles();      for (int i = 0; i < files.length; i++) {        if (files[i].isDirectory()) {          doDir(files[i]);        } else {          doFile(files[i]);          tot++;        }      }    } catch (Exception error) {    }  }  public void doFile(File file) {    String path =  tPath();    out.append(path + "\r\n");  }}