Question: Write a method called largestRow that take a two-dimension array of integers as a parameter and returns the number of the row that has the

Write a method called largestRow that take a two-dimension array of integers as a parameter and returns the number of the row that has the largest sum. For example, if the array (as created by the program below) is 8 10 45 3 2 42 3 21 44 The value returned would be zero (row zero has the largest sum). public class Question2 { public static void main(String args[]) { int arr[] [] {{10, 45, 3, 8}, {2, 42}, {3, 21, 44}}; System.out.println("The row with the largest sum is "+largestRow (arr)); } //main Write a method called largestRow that take a two-dimension array of integers as a parameter and returns the number of the row that has the largest sum. For example, if the array (as created by the program below) is 8 10 45 3 2 42 3 21 44 The value returned would be zero (row zero has the largest sum). public class Question2 { public static void main(String args[]) { int arr[] [] {{10, 45, 3, 8}, {2, 42}, {3, 21, 44}}; System.out.println("The row with the largest sum is "+largestRow (arr)); } //main
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
