• Register
0 votes

Problem :

I am a beginner to Java programming. While executing my program i got below error
exception in thread "main" java.lang.arrayindexoutofboundsexception: 10
6 5 3
6,930 points

1 Answer

0 votes

Solution :

The problem is you have 50 students in your class and you want to view the value of the 51st student

if you make this int i[4] then i takes values i[0] i[1] i[2] i[3]

ftp resolve your problem you can try bellow code sample

double[] array = new double[50];

    for (int j = 0; j < 24; j++) {


    for (int k = 25;  < 50; k++) {

9 7 4
38,600 points

Related questions

1 vote
1 answer 20 views
Problem : I have very recently started to learn programming in Java. I am trying to execute my java code but I am facing the below error. &ldquo;Exception in thread "main" java.lang.arrayindexoutofboundsexception:&rdquo; I am unable to understand above error. Please find below my code: ... according to my debugger*/ myodd[j] = input[i]; j++; } return myodd; } Please help me in fixing above error.
asked Mar 30 morrisBson 3.2k points
0 votes
1 answer 35 views
Problem : Currently I am learning Java. I have written code in Java but it gives me below error &ldquo;Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at Minesweeper.main(Minesweeper.java:5)&rdquo;. I am unable to understand above error. How can I fix above error.
asked Feb 22 mphil 2.3k points
0 votes
1 answer 18 views
I wrote some code in java: public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter size of array:"); int size = sc.nextInt(); int[] intArray = new int[size]; for ( ... .journaldev.exceptions.ArrayIndexOutOfBoundsExceptionExample.main(ArrayIndexOutOfBoundsExceptionExample.java:23) What is the problem in my code and why am I getting this kind of error?
asked Mar 14 LizzyM 6.1k points
0 votes
1 answer 13 views
explain with an example?
asked Nov 18 jagruthi 680 points
0 votes
1 answer 31 views