public class url {
public static void main(String[] args) throws Exception {
URL imdb = new URL("http://www.omdbapi.com/?t=The%20incredible%20Hulk");
URLConnection yc = imdb.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(
yc.getInputStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
String[] strarr = inputLine.split(",");
System.out.println("splits.size: " + strarr.length);
in.close();
}
}
错误是:“imdb.url.main(url.java:25) 处的线程“main”java.lang.NullPointerException 中的异常”
请向我解释如何删除它。我在使用拆分函数和空指针异常方面搜索了很多,但就是不明白我做错了什么。