public class ArrayDemo5{ public static void main(String[] args){ int[][] arr=new int[3][]; arr[0]=new int[]{41,22}; arr[1]=new int[]{31,12,13}; arr[2]=new int[]{3,2,63,38}; int sum=0; for(int i=0;i<arr.length;i++){ int group=0; for(int j=0;j<arr[i].length;j++){ group=group+arr[i][j]; } sum=sum+group; System.out.println("第"+(i+1)+"组的销售额为"+group+"万元"); } System.out.println("销售总额为"+sum); } }