Question 3 5 points You have an int array named examScores t

Question 3 (5 points)

You have an int array named examScores that is 1000 elements in length.
Provide a single line of code that would sort the examScores. (Note: You do not need to provide the import statements supporting the line of code)

Solution

Java provides a static method called sort of the class Arrays that sorts the an array of any type,Object or primitive type
public static void sort(int[] a);

Single line:
                  Arrays.sort(examScores);

The above statement that takes an array name, examScores
and sorts the elements in the array examScore in ascending order for integer array.

Question 3 (5 points) You have an int array named examScores that is 1000 elements in length. Provide a single line of code that would sort the examScores. (Not

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site