ArrayIndexOutOfBoundsException | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 6

ArrayIndexOutOfBoundsException

31st Jan 2018, 8:55 AM
Randhir Bais
7 ответов
+ 24
An array-index out of bounds exception is a Java exception thrown becoz the program is trying to access an element at a position that is outside an array limit, hence the words "Out of bounds". In other words, the program is trying to access an element at an index that is outside the array bounds.
31st Jan 2018, 9:12 AM
Anisha
Anisha - avatar
+ 17
@Randhir , use try/catch block //put statement(s) in which error can occur in try block //put statement(s) , what to do in catch block ... like printing some message on screen ... like "maximum index is _ " & then exit try {//statement(s);} catch (ArrayIndexOutOfBoundsException e){ System.out.print ("see max index possible"); }
31st Jan 2018, 9:25 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 12
what about them?
31st Jan 2018, 8:57 AM
Vukan
Vukan - avatar
+ 9
Please ask your question properly... https://www.sololearn.com/discuss/321242/?ref=app
31st Jan 2018, 9:03 AM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 9
You may surround your code with try/catch block
31st Jan 2018, 9:13 AM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 5
how can i avoid ArrayIndexOutOfBoundsException in my company software
31st Jan 2018, 9:12 AM
Randhir Bais
1st Feb 2018, 4:22 AM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar