public class Student {//定义学生类
//定义四个属性
private String [] xh = new String [3];
private String [] xm = new String [3];
private char [] xb= new char [3];
private int[] nl= new int[3];
//构造方法,循环为数组赋值
public Student() {
for(int i=0; i
xm[i] = "xm" + i;
xb[i] = 'a';
nl[i] = i+12;
}
}
//有四个参数的方法
public void getValue(int xh, int xm, int xb, int nl) {
//有点不明白你要在这个方法里做什么?题目表达的意思不好理解
System.out.println("学号:" + this.xh[xh] +" 性名:"+ this.xm[xm] +" 性别:"+ this.xb[xb] +" 年龄:"+ this.nl[nl]);
}
//main方法
public static void main(String[] args) {
Student student = new Student();
student.getValue(1, 1, 1, 1);
}
}