package comm.ddd.eee;
class Student {
String name;
String sex;
int old;
public Student () {
}
public Student (String aName, String aSex, int aOld) {
name = aName;
sex = aSex;
old = aOld;
}
public void show () {
System.out.println("姓名:" + name + "\t性别:" + sex + "\t年龄:" + old);
}
}
public class Sh5 {
public static void main(String[] args) {
Student lxm = new Student("刘晓明","男",18);
lxm.show();
}
}
Java学习记录:构造方法的使用
最新推荐文章于 2024-08-12 15:45:48 发布