Respuesta :
Answer:
This method will print three rows and four columns of "#"
####
####
####
Explanation:
Given the method patternGrid() as follows:
- public static void patternGrid(int rows, int columns, char symbol)
- {
- for(int m = 0; m < rows; m++)
- {
- for(int n = 0; n < columns; n++)
- {
- System.out.print(symbol);
- }
- System.out.println();
- }
- }
Inside the method, there is a two-layer for-loop (Lind 3 - 11). In a two-layer for loop, A single iteration of the outer loop (Line 3) will be accompanied with n-iterations of inner loop (Line 5).
By calling the function patternGrid(3, 4, "#"), the 3 will be used as the rows number while 4 used as the columns number. The two-layer for loop will run for 3 x 4 times. The symbol "#" will be printed four times within the inner loop (Line 7) before it exists from the inner loop and print a new line (Line 10). This process will be repeated for 3 times and eventually give
####
####
####