• 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.9k points

Please log in or register to answer this question.

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++) {

38.6k points
edited by

Related questions

1 vote
1 answer 13 views
Problem: I&rsquo;ve been learning programing (java) and my teacher gave me this question : Write a program that declares an array "alpha" of 50 elements of type "double". Initialize the array so that the first 25 elements are equal to the square of the index variable and the last 25 ... count++; if (count==10) { System.out.println("/n"); count=0; } } } } Hope someone can solve this problem.
asked Apr 30 Raj Tyagi 16k points
1 vote
1 answer 33 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, 2020 morrisBson 3.2k points
0 votes
1 answer 11 views
Problem: I am a new Java programmer. The following is my code: public static void main(String[] args) throws Exception { BPM2SampleProcessor processor = new BPM2SampleProcessor(); processor.setSampleSize(1024); EnergyOutputAudioDevice output = new EnergyOutputAudioDevice(processor); ... new Player(new FileInputStream(args[0]), output); Please explain what the error is and how to overcome it.
asked May 1 anika11 32.2k points
0 votes
1 answer 56 views
0 votes
1 answer 79 views
0 votes
1 answer 24 views
Thank you in advance for any help?
asked Jan 5 TeamScript 13.5k points
0 votes
1 answer 126 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, 2020 mphil 2.3k points
0 votes
1 answer 34 views
Problem: Does anyone have an answer to this : Exception in thread awt eventqueue 0 java lang arrayindexoutofboundsexception?
asked Jun 15 Priscilla Gurpreet 71k points
0 votes
1 answer 10 views
Problem: What exactly is the solution : Java.lang.arrayindexoutofboundsexception: length=0; index=0?
asked Jun 22 Nahil 122k points
0 votes
1 answer 9 views
Problem: Exception in thread main java lang nosuchmethoderror.
asked Jun 26 Shima 122k points