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("table").get(0);
有时没有桌子,但我仍然在做,所以我是
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
如何摆脱这个异常?没有大小,因为这是元素
Elements是从选择返回的对象。
Elements tables = doc.select("table");
它有一个size方法。所以你可以打电话:
tables.size();