Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私は持っている
要素リスト = doc.select("テーブル").get(0);
テーブルが存在しない場合もありますが、私はまだ get を行っています。
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
この例外から抜け出すには?これは要素なのでサイズはありません
Elementsは、select から返されるオブジェクトです。
Elements tables = doc.select("table");
それにはsizeメソッドがあります。したがって、次のように呼び出すことができます。
tables.size();