package com.atguigu.exer;
public class studentTest {
public static void main(String[] args) {
//声明一个student 类型的数组
Student[] stus = new Student[20];
for(int i = 0;i<stus.length;i++) {
stus[i] = new Student();
stus[i].number = i+1;
stus[i].state = (int)(Math.random()*(6-1+1)+1);
stus[i].score = (int)(Math.random()*(100-0+1));
}
}
}
class Student{
int number;//学号
int state;//年级
int score;//成绩
}
这两天一直在学习面向对象,开始找到一点感觉了,不能一味的去敲代码,可以停下来去看一看定义,然后和代码结合一起去看,相互印证,会有一个不错的效果。