How can you pass a two-dimensional array to a method? Provide some examples.
What will be an ideal response?
When you pass a two-dimensional array to a method, you pass the array name just as you do with a one-dimensional array. A method that receives a two-dimensional array uses two bracket pairs following the data type in the parameter list of the method header. For example, the following method headers accept two-dimensional arrays of ints, doubles, and Employees, respectively:?public static void displayScores(int[][]scoresArray)public static boolean areAllPricesHigh(double[][] prices)public static double computePayrollForAllEmployees(Employee[][] staff)?In each case, notice that the brackets indicating the array in the method header are empty. There is no need to insert numbers into the brackets because each passed array name is a starting memory address. The way you manipulate subscripts within the method determines how rows and columns are accessed.
You might also like to view...
A ________ is similar to an online journal, in which you can write about anything you want to share
A) bulletin B) log C) chronicle D) blog
Which of the following is not a class UIManager method?
a. LookAndFeelInfo(). b. getInstalledLookAndFeels(). c. setLookAndFeel(). d. getLookAndFeel().