标题:刚学Java,请帮忙看看这两个类,为什么会显示找不到符号
取消只看楼主
一二三四
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-12-2
 问题点数:0 回复次数:1 
刚学Java,请帮忙看看这两个类,为什么会显示找不到符号
包都是用的import java.*
public class InputReader
{
    public HashSet<String>getInput()
    {
        System.out.print("> ");
        String inputLine=reader.nextLine().trim().toLowerCase();
        String[] wordArray=inputLine.split(" ");
        HashSet<String>words=new HashSet<String>();
        for(String word:wordArray){
            words.add(word);
        }
        return words;
    }
}
public class Responder
{
   
   public Responder()
   {
       responseMap=new HashMap<String,String>();
       fillResponseMap();
    }
   private void fillResponseMap()
   {
       responseMap.put("slow","I think this has to do with your hardware.\n");
       responseMap.put("bug","Well,you know,all software has some bugs.\n");
       responseMap.put("expensive","The cost of our product is quite competitive.\n");
    }
   public String generateResponse(HashSet<String> words)
   {   
       Iterator<String> it=words.iterator();
       while (it.hasNext())
       {
       String word=it.next();
       String response=responseMap.get(word);
           if(response!=null){
               return response;
            }
        }
        return pickDefaultResponse();
    }
   public String pickDefaultResponse()
   {
       return("I need more information.");
    }
}
搜索更多相关主题的帖子: Java String 符号 public Responder 
2008-05-14 23:13
一二三四
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2007-12-2
得分:0 
谢谢
2008-05-15 09:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-214340-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.102655 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved