Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0

why im getting this error ?

18th Nov 2022, 3:24 PM
shivam prajapati
shivam prajapati - avatar
2 Answers
+ 5
It means You are trying to attempt elements of array beyond it's boundary or exceed length.. edit: yes. Empty array accessing..
18th Nov 2022, 3:25 PM
Jayakrishna 🇮🇳
+ 4
It write exactly the issue. The array is empty (length=0) and you try acess the 1st element(index=0).
18th Nov 2022, 3:36 PM
Giannis
Giannis - avatar