29得票3回答
为什么在Java 16中IndexOutOfBoundsException现在有一个以long索引为参数的构造函数?

我正在检查JDK 16中IndexOutOfBoundsException的实现,发现引入了一个带有long索引的新构造函数: /** * Constructs a new {@code IndexOutOfBoundsException} class with an * argumen...

27得票7回答
无越界错误

我有这样一段 C 代码,它接收一堆 char。#include<stdio.h> # define NEWLINE '\n' int main() { char c; char str[6]; int i = 0; while( ((c = getchar()) != NEWL...

25得票2回答
ArrayList.add抛出ArrayIndexOutOfBoundsException异常

我正试图将一个对象添加到 ArrayList 中,但出现了 ArrayIndexOutOfBoundsException 异常。以下是代码:private void populateInboxResultHolder(List inboxErrors){ inboxList = new...

24得票6回答
在java.util.List中任意位置插入

根据文档,您可以在List中的任何位置插入对象: 使用此接口的用户精确控制每个元素插入列表的位置。 (来源:http://download.oracle.com/javase/6/docs/api/java/util/List.html) 但是以下程序会抛出IndexOutOfB...

21得票3回答
Froyo上的ListView随机IndexOutOfBoundsException

我的应用程序已经被下载了很多次,但我收到了大量这个错误: 16783 AndroidRuntime E java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 16783 Androi...

20得票3回答
Java中的越界检查

我想检查一个数组位置是否越界,最简单的方法是什么?int[] arr; populate(arr); if(arr[-1] == null) //out of bounds! 这样的东西可行吗? 我相信可以用try-catch或scanner实现,但对于一个简单的小程序,是否有其他方法?

20得票4回答
NSArray越界检查

初学者问题.. 如何最好地检查NSArray或NSMutableArray的索引是否存在。我已经到处搜索,但没有找到解决方法! 这是我尝试过的:if (sections = [arr objectAtIndex:4]) { /*.....*/ } 或者sections = [arr ...

18得票4回答
Java SimpleDateFormat 出现奇怪的 ArrayIndexOutOfBoundsException 错误

我们使用Java 1.4版本。 我们有这个方法: static SimpleDateFormat xmlFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); public static Date fromXml(String...

18得票3回答
在Play商店的预启动报告中,Android应用程序崩溃,但在真实设备中却可以运行。

在项目中无法跟踪崩溃,我在Play Store预启动部分遇到了这个错误,在点击EditText时,它产生了这个错误。但在真实设备上没有任何崩溃。 问题:java.lang.IndexOutOfBoundsException: setSpan(4 ... 4)超出长度0的范围Fatal Exc...

18得票10回答
在向ArrayList的索引位置添加元素时出现了IndexOutOfBoundsException异常。

我在下面的代码中得到了异常Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 1, Size: 0,但是我不明白原因。public class App { public static void m...