import java.util.Scanner; public class stu { public static void main(String[] arge){ System.out.print("请输入班级人数:"); Scanner sca=new Scanner(System.in);//创建扫描对象,获取键盘上输入 Scanner scanner=new Scanner(System.in); int num=scanner.nextInt(); int i=0; int sum=0; while(i<num){ System.out.print("请输入分数"); Scanner scanner1=new Scanner(System.in);//创建扫描对象,获取键盘上输入 int score=scanner.nextInt(); sum=sum+score; i++; } double avg=sum/num; System.out.print("平均数为"+avg); // String str=sca.next();//从键盘上输入的对象转换为字符串 // int a=sca.nextInt();//键盘上输入的对象转换成int //System.out.print(str); //System.out.print(a); } }