Question: import java.util.Scanner; public class OutputArray { // main method creates array named data 100x100 public static void main(String[] args) { Scanner sc = new Scanner

import java.util.Scanner; public class OutputArray { // main method creates array named data 100x100 public static void main(String[] args) { Scanner sc = new Scanner (System.in); String[][] data = new String [100][100]; // takes user input for rows and columns, stores in int variables rows, cols System.out.print("Enter number of rows."); int rows = sc.nextInt(); System.out.print("Enter number of columns."); int cols = sc.nextInt(); // ex. rows is 4 and cols is 2... //fills selected subarray with random letter of alphabet... how to resolve valueOf? System.out.println("Original 2D array:"); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { int index = (int) (Math.random() *26); char letter = (char) ('A' + index); data [i][j] = String.valueOf(letter); System.out.print(data[i][j] + " "); } System.out.println(); } System.out.println("Combinations:"); printCombinations(data, 0, rows, cols, ""); } // calls printCombinations method... passes array, current row start at 0? // rows, cols, current Output??? just a blank space? or... ??? // I don't understand how the section below works... public static void printCombinations(String[][] data, int currRow, int maxRows, int maxCols, String currentOutput) { if (currRow >= maxRows) { System.out.println(currentOutput); return; } for (int i = 0; i < maxCols && i < data[currRow].length; i++) { printCombinations(data, currRow +1, maxRows, maxCols, currentOutput + data[currRow][i] + " "); } } }

When I copy this program, it gives me three errors. Could someone explain how to fix this?

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!