...
/Solution Review: Find the Top Scorer in a Class
Solution Review: Find the Top Scorer in a Class
Have a look at the solution to the 'Find the Top Scorer in a Class' challenge.
We'll cover the following...
Rubric criteria
Solution
Press + to interact
class Maximum{public static void main(String args[]){int[] array = {34, 2, 7, 12}; // Creating an array to store students' marksSystem.out.println(Max(array)); // Passing the array to the Max function}// Function to find maximum value from arraypublic static int Max(int array[]){int max = 0; // Keeping track of max valuefor(int i = 0; i < array.length; i++) // Traversing array till the end{if (max < array[i]) // If value is greater than max{max = array[i]; // Update max}}return max;}}