class HalfDollars { public static void main(String [] arguments) { int[] denver = {1_900_000,1_700_000,1_700_000 }; int[] philadelphia ={1_900_000,1_800_000,1_750_000}; int[] total = new int[denver.length]; int average = (int)(total[0]+total[1]+total[2])/3; for (int i=0,int j=2009;i<3;i++,j++) { total[i]=denver[i]+philadelphia[i]; System.out.print(j+"production:"); System.out.format("%,d%n",total[i]); } System.out.print("Average production:"); System.out.format("%,d%n",average); } }
1_900_000 这是int ?下载个eclipse来写代码吧eclipse.org