亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

大神們,輸入城市后出現這樣的情況該怎么解決啊


package?TianQiYuBao;

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("輸入想要查詢的天氣:24小時。:三天。:七天。");
????????System.out.print("輸入你的選擇:");
????????Scanner?scanner?=?new?Scanner(System.in);
????????int?i?=?scanner.nextInt();
????????System.out.println("你輸入的是:"+i);
????????if?(i?==?24){
????????????System.out.print("輸入要查詢的城市名稱:");
????????????String?city?=?scanner.next();
????????????WeatherUtils?weatherUtils?=?new?WeatherUtilsImpl();
????????????List<HourWeather>?weatherList?=?weatherUtils.w24h("553d41feff124ac6a2fce95fc0810eba",city);
????????????//System.out.println(weatherList);
????????????if?(weatherList.size()?==?0){
????????????????System.out.println("抱歉,未查詢到您想要的數據。");
????????????}else{
????????????????for?(HourWeather?hourWeather?:?weatherList){
????????????????????String?template?=?"%s月%s日%s時|%s|%s|%s|%s@";
????????????????????String?row?=?String.format(template,new?String[]{
????????????????????????????hourWeather.getMonth(),
????????????????????????????hourWeather.getDay(),
????????????????????????????hourWeather.getHour(),
????????????????????????????hourWeather.getWindDirection(),
????????????????????????????hourWeather.getWindPower(),
????????????????????????????hourWeather.getWeather(),
????????????????????????????hourWeather.getTemperature()
????????????????????});
????????????????????System.out.println(row);
????????????????}
????????????}
????????}
????}
}

http://img1.sycdn.imooc.com//604f6f680001acce16280182.jpg

http://img1.sycdn.imooc.com//604f6f680001416011750845.jpg

http://img1.sycdn.imooc.com//604f6f6800011c4819201042.jpg

正在回答

2 回答

http://img1.sycdn.imooc.com//60f438620001516015150782.jpg

WeatherUtilsImpl類里的appCode一樣才行
0 回復 有任何疑惑可以回復我~

看一下購買的api是不是老師那個,如果不完全一樣,那就需要修改url

0 回復 有任何疑惑可以回復我~
#1

Yuthin

請問具體怎么修改呢
2021-03-18 回復 有任何疑惑可以回復我~
#2

hey_小史

回復 Yuthin就按照教程再買一次,輸入正確的code應該就可以
2021-05-17 回復 有任何疑惑可以回復我~
#3

修羅旗手

請問一下和老師的api一模一樣,還是報這個錯,是啥原因啊。。。
2021-06-01 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

大神們,輸入城市后出現這樣的情況該怎么解決啊

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號