Question: 2. (5 points) Identify the logical error in the following code. The error is conceptual (that is, the code does not work as described), and

 2. (5 points) Identify the logical error in the following code.

2. (5 points) Identify the logical error in the following code. The error is conceptual (that is, the code does not work as described), and not a syntactic error (that is, an error the compiler would identify). * Compute the largest absolute difference between any two elements in the list. public int largestDifference (List 1){ int largest Difference - Integer .MAX_VALUE; for (Integer i : 1) { for (Integer j : 1) { int diff - Math.abs(i - j); if (diff > largest Difference) { largest Difference - diff; } } return largestDifference; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!