System.out.println("请输入查询参数:");
putIn = Integer.parseInt(bReader.readLine()); System.out.println("开始查询,请稍候……");
switch (putIn) {
case 0: //查找指定的信息
HttpMethod method = new GetMethod(currURL);
client.executeMethod(method);
........
break;
case 1: //查找洗衣粉
........
case 2: //查找香皂
........
其中,以0,1,2代表的商品在下面要显示出来,问你怎么编写一个程序
请你输出你购买的商品:香皂
明白了没,在上面你输入的不是2而是香皂,请
问一下怎么写一个程序输出<香皂>后打出它的相应信息,有点不会
putIn = Integer.parseInt(bReader.readLine()); System.out.println("开始查询,请稍候……");
switch (putIn) {
case 0: //查找指定的信息
HttpMethod method = new GetMethod(currURL);
client.executeMethod(method);
........
break;
case 1: //查找洗衣粉
........
case 2: //查找香皂
........
其中,以0,1,2代表的商品在下面要显示出来,问你怎么编写一个程序
请你输出你购买的商品:香皂
明白了没,在上面你输入的不是2而是香皂,请
问一下怎么写一个程序输出<香皂>后打出它的相应信息,有点不会
eg:Map<String, Integer> param = new HashMap<String, Integer>();
param.put("香皂",2);
param.put("洗衣粉",1);然后用控制台输入的字符串最为key去map中拿值,最后用map中的值作为switch的参数判断