java.lang.ArrayIndexOutOfBoundsException [英] java.lang.ArrayIndexOutOfBoundsException

查看:88
本文介绍了java.lang.ArrayIndexOutOfBoundsException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了

线程中的例外情况主要 java.lang.ArrayIndexOutOfBoundsException:2

在Producent.main(producent.java:605)


当我从蝙蝠运行时


@start供应链管理 - 生产者到队列运行生产队列1队列2队列3队列4


也许你会看到我看不到的东西

展开 | 选择 | 换行 | 行号

解决方案


i get

线程main中的异常java.lang.ArrayIndexOutOfBoundsException:2

在Producent.main(producent.java:605)


当我从蝙蝠运行时


@start供应链管理 - 生产者到队列运行生产队列1队列2队列3队列4


也许你会看到我看不到的东西

展开 | 选择 | 换行 | 行号


我将它更改为

if(args.length< 1 || args.length> 3)但stiil得到异常


< blockquote>


i将其更改为

if(args.length< 1 || args.length> 3)但stiil获得异常



你为自己复杂化了。如果你的数组中至少有4个对象,那么你不想只运行它。


i get
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at Producent.main(producent.java:605)

when i run it from bat

@start "Supply Chain Management-Producer to Queue" run Producent queue1 queue2 queue3 queue4

maybe you will se something i dont see

Expand|Select|Wrap|Line Numbers

解决方案

i get
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at Producent.main(producent.java:605)

when i run it from bat

@start "Supply Chain Management-Producer to Queue" run Producent queue1 queue2 queue3 queue4

maybe you will se something i dont see

Expand|Select|Wrap|Line Numbers


i changed it to
if (args.length < 1 || args.length > 3)but stiil get the exception


i changed it to
if (args.length < 1 || args.length > 3)but stiil get the exception

You are complicating things for your self. Don''t you just want to run this if you have at least 4 objects in your array.


这篇关于java.lang.ArrayIndexOutOfBoundsException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆