本帖最后由 bristolcc 于 2010-08-06 06:49:16 编辑

解决方案 »

  1.   

    Command类import java.util.ArrayList;public class Command {
    private ArrayList<String> command;
    private Parser parser;

    public Command(){
    command = new ArrayList<String>();
    parser = new Parser();

    command.add(parser.getFirstWord());
    command.add(parser.getSecondWord());
    }

    public String getFirstCommand(){
    return command.get(0);
    }

    public int getSecondCommand(){
    return Integer.parseInt(command.get(1));
    }

    }WriteFile类
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.PrintWriter;public class WriteFile {
    private String report;
    private String result;
    private PrintWriter pwCheck;
    private PrintWriter pwResult;

    public WriteFile(){
    this.report = "";
    this.result = "";
    }

    public void Write(String s){
    report += s;
    try {
    pwCheck = new PrintWriter(new FileOutputStream("check.txt"));
    } catch (FileNotFoundException e) {
    System.out.println("cannot create or write file");
    }
    pwCheck.println(report);
    pwCheck.close();
    }

    public void Result(String info){
    result += info;
    try {
    pwResult = new PrintWriter(new FileOutputStream("result.txt"));
    } catch (FileNotFoundException e) {
    System.out.println("cannot create or write file");
    }
    pwResult.println(result);
    pwResult.close();
    }
    }
      

  2.   

    该程序只在www.myspace.com中搜索。请各位朋友注意