This is the error i get..
Enter employee name: Bryan
Enter employee's salary: 123
Enter employee name: Mark
Enter employee's salary: 456
Enter employee name: Fajutag
Enter employee's salary: 789
Enter employee name: qwe
Enter employee's salary: 32
Enter employee name: qew
Enter employee's salary: 312
Enter employee name: qew
Enter employee's salary: 65
Enter employee name: qwe
Enter employee's salary: 654
Enter employee name: qwe
Enter employee's salary: 654
Enter employee name: qwe
Enter employee's salary: 654
Enter employee name: qwe
Enter employee's salary: 645
Number of employees with salaries of at least P 18,000 :0
Number of employees with salaries of below P 18,000 :10
Total salary paid to all the employees : P4384
java.lang.ArrayIndexOutOfBoundsException: 10
at Salary.Employee(Salary.java:41)
at Salary.main(Salary.java:85)
Exception in thread "main"
Process completed.
What is the solution to this error
java.lang.ArrayIndexOutOfBoundsException: 10
at Salary.Employee(Salary.java:41)
at Salary.main(Salary.java:85)
Exception in thread "main"
aabbccbryanmark
0
Light Poster
Recommended Answers
Jump to Postjava.lang.ArrayIndexOutOfBoundsException: 10
the problem is: your array is declared as an array of 10 elements, which sets the valid index-range from 0 to 9, yet somewhere you are trying to access the element on index 10
try by resetting the value from ctr1. also, you may want to re-format the …
Jump to Postjava.lang.ArrayIndexOutOfBoundsException: 10
at Salary.Employee(Salary.java:41)This also tells you the problem is on line 41 of Salary.java
All 5 Replies
stultuske
1,116
Posting Maven
Featured Poster
aabbccbryanmark
0
Light Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
aabbccbryanmark
0
Light Poster
stultuske
1,116
Posting Maven
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.