-5
내가 프로그래밍 초보자 오전
는 사람이어떻게 배열에서 배열을 반환합니까?
public int [][]matrixSetup(String size, char i) throws IOException {
int size_num = Integer.parseInt(size);
if (size_num > 1 && size_num < 4) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("input the value store them, they arrange as" + i + "11,"+ i+ "12," + i +"21,"+ i +"22 etc");
for(int row = 0; row < size_num ; row++)
for(int col = 0 ; col < size_num ; col++){
int [][]A = new int [size_num][size_num];
String ipS = br.readLine(); //ipS = input String
int input_value = Integer.parseInt(ipS);
A[row][col] = input_value;
}
} else System.out.println("invalid matrix size!");
return A; //How to return the matrix?
}
그것의 각 반복에 대한 새로운 배열을 만들 –
자바 언어. 루프 외부에 A를 작성해야합니다. – eternay
[가변 범위] (http://www.java-made-easy.com/variable-scope.html)에 대해 알아보십시오. – GriffeyDog