為什么我的代碼只能查24小時的
package?com.H.weather; import?com.imooc.weather.HourWeather; import?com.imooc.weather.WeatherUtils; import?com.imooc.weather.impl.WeatherUtilsImpl; import?java.util.List; import?java.util.Scanner; public?class?Application?{ ????public?static?void?main(String[]?args)?{ ????????System.out.println("查詢最近天氣預(yù)報"); ????????System.out.println("輸入1:查詢未來24小時天氣預(yù)報"); ????????System.out.println("輸入2:查詢未來3天天氣預(yù)報"); ????????System.out.println("輸入3:查詢未來7天天氣預(yù)報"); ????????System.out.print("請輸入您的選擇:"); ????????Scanner?scanner=new?Scanner(System.in); ????????int?i=?scanner.nextInt(); ????????System.out.println("用戶輸入數(shù)字:"+i); ????????if?(i==1){ ????????????System.out.println("請輸入城市名稱查詢未來24小時天氣預(yù)報"); ????????????String?city=?scanner.next(); ????????????WeatherUtils?weatherUtils?=?new?WeatherUtilsImpl(); ????????????List<HourWeather>weatherList=weatherUtils.w24h("d0c4a0b00eb14c21903e8ea220dc68ef",city); ????????????System.out.println(weatherList); ????????} ????} }
我這個運(yùn)行起來之后就只能查24小時的,其他的輸入數(shù)字之后不會讓輸入城市,就結(jié)束了