当前位置:编程学习 > JAVA >>

java,到main这下面画虚线,说void is an invalid type for the variable main.定义是无效的对可变的main

public class ArrayAvg { public static void main(String[] args){ final int ARRAY_SIZE=10; int a[]=new int[ARRAY_SIZE]; int i=0; int sum=0; double avg=0.0; for(i=0;i<a.length;i++){ a[i]=(int)(Math.random()*10); sum=sum+a[i]; System.out.print(""+a[i]); } avg=(double)sum/a.length; System.out.println("averger="+avg); } }
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,