public class Two_Test {
/**
* Assign a value to an array
* Pass an integer array parameter
* The return value is an integer array
*/
public int[][] getArray(int[][] inttwo) {
for (int i = 0; i < inttwo.length; i++) {//Row loop, each row executed will execute all columns
for (int j = 0; j < inttwo[i].length ; j++) {//Column loop
inttwo[i][j] = i + j;//The value of a certain element == row number + column number
}< /p>
}
return inttwo;//Return the assigned array
}
/**
* Output all elements of an array
*/
public void printArray(int[][] inttwo) {
for (int i = 0; i < inttwo.length; i++) {//Row loop
for (int j = 0; j < inttwo[i].length; j++) {//Column loop
System .out.println("index[" + i + "][" + j + "]:"
+ inttwo[i][j]);//Output all arrays according to their subscripts The value in
}
System.out.println();//The fourth output prints a newline statement
}
}
public static void main(String args[]) {//Main function
Two_Test test = new Two_Test();//Instantiate an object of a class
int[][] inttwo = new int[3][4];//Define an array with 3 rows and 4 columns
int[][] printArray = test.getArray(inttwo) ;//The object calling method returns an array
test.printArray(printArray);//Print out this array
}
}
< p>We have talked about it to this extent...I think there is nothing else to say?I wish the poster an early success!