Java: Program produces console output, but has run time error?
Go to solution
Solved by 79wjd,
Don't reinitialize numElem.
You have an array out of bounds an exception (i.e. you're accessing an index that doesn't exist).
(I'm assuming there are potentially other test cases)
Try putting in some print statements and you'll see exactly where the exception is occurring.
-
Featured Topics
-
Topics
-
naldo29 ·
Posted in Troubleshooting0 -
1
-
MahdiC ·
Posted in Networking1 -
1
-
Sychicyuto ·
Posted in Troubleshooting2 -
ItzEager ·
Posted in Troubleshooting3 -
0
-
TheIndecisiveMollusk ·
Posted in New Builds and Planning1 -
4
-
Agall ·
Posted in CPUs, Motherboards, and Memory4
-
-
play_circle_filled
Latest From Linus Tech Tips:
I Am Not Buying A Super Computer - WAN Show May 3, 2024
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now