次のようにプログラムを書くと、このようなエラーが出てしまいます。
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
at ex9_0b.main(ex9_0b.java:8)
どうすれば良いですか?
import java.io.;
import java.net.;
public class aaa {
public static void main(String args[]) {
URL theUrl;
try{
theUrl = new URL(args[0]);
} catch( MalformedURLException A ) {
return;
}
try{
HttpURLConnection huc = (HttpURLConnection)theUrl.openConnection();
InputStream instream = huc.getInputStream();
InputStreamReader isreader = new InputStreamReader(instream);
BufferedReader bfreader = new BufferedReader(isreader);
String theLine;
do { theLine = bfreader.readLine(); if( theLine != null ) { System.out.println(theLine); } } while( theLine != null ); } catch (Exception e) { System.err.print(e); }
}
}
回答2件
あなたの回答
tips
プレビュー