class Demo{
public static void main(String[] args){
int[][] arr = new int[2][3] ;
System.out.println(arr) ;
System.out.println(arr[0][1]) ;
System.out.println(arr[1][2]) ;
System.out.println(arr[1][0]) ;
arr[0][1] = 10 ;
arr[1][2] = 20 ;
System.out.println(arr) ;
System.out.println(arr[0][1]) ;
System.out.println(arr[1][2]) ;
System.out.println(arr[1][0]) ;
}
}
class Demo{
public static void main(String[] args){
int[][] arr = new int[3][] ;
arr[0] = new int[2] ;
arr[1] = new int[3] ;
arr[2] = new int[1] ;
System.out.println(arr) ;
System.out.println(arr[0][0]) ;
System.out.println(arr[1][2]) ;
System.out.println(arr[2][0]) ;
arr[0][1] = 20 ;
arr[1][0] = 10 ;
arr[1][2] = 30 ;
arr[2][0] = 100 ;
System.out.println(arr) ;
System.out.println(arr[0][0]) ;
System.out.println(arr[0][1]) ;
System.out.println(arr[1][0]) ;
System.out.println(arr[1][2]) ;
System.out.println(arr[2][0]) ;
}
}
转载请注明原文地址:https://blackberry.8miu.com/read-33354.html