Page 1 of 1

About Question enthuware.ocajp.i.v8.2.2015 :

Posted: Wed Jan 19, 2022 5:43 pm
by tangjm
There seems to be an easier explanation. If you observe closely, all but one of the options will result in an ArrayIndexOutOfBoundsException. All of the options involve matrices with a first dimension expression of 4 or 5, yet only one of the options have a 'for' loop termination condition of i < 5. The others therefore end up trying to access the 5th index of an array with only 4 or 5 elements.

In light of the enthuware explanation, I think this wasn't what the question was trying to test. Maybe change the available answer options or recategorise the question?

Re: About Question enthuware.ocajp.i.v8.2.2015 :

Posted: Thu Jan 20, 2022 12:12 am
by admin
Yes, process of elimination is a good way to spot the wrong options. It is a useful strategy when you are not sure about the right approach to solve the given problem. The purpose of the explanation is to show you the right approach.