I am new to programming. I've been in a class for a week now and I am stuck on this problem for most of my java programs. There was an exception for one of the programs where the code executed perfectly and showed the desired results.But for some of my other programs I have been getting the same error,
"Exception in thread "main" java.lang.ArrayOutOfBoundsException: 2.
I've been stuck on this for the past few days and I've searched everywhere online for a solution but there isn't any that works for my problem.
The following is a screenshot of my code. A simple program that takes three int command-line arguments and determines whether they constitute the side lengths of some right triangle.
This is the error I get when I run the code:
My class moves quickly so I am behind on other submissions so if you can please help me out.
I tried creating a program that determines whether three int values belong to a right-angled triangle. The assignment had two conditions;
- Each integer must be positive
- The sum of the squares of two of the integers must equal the square of the third integer.
I declared and assigned the integers and then created conditions to satisfy the assignment conditions. I expected to get the three values and the result of boolean isRightTriangle.