发布网友 发布时间:4小时前
共5个回答
热心网友 时间:4小时前
编写学生类Student,属性包含姓名,年龄,性别,根据该类分别创建五个学生对象,如下:
热心网友 时间:4小时前
正式宣布你挂了,明年重修。
热心网友 时间:4小时前
public class Student {
private String name;
private String age;
private String gender;
public Student() {
}
public Student(String name, String age, String gender) {
this.name = name;
this.age = age;
this.gender = gender;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAge() {
return age;
}
public void setAge(String age) {
this.age = age;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
}
=========以上为Student类=========
public class Main{
public static void main(String[] args) {
Student xiaoming = new Student("小明","10","男");
Student xiaohong = new Student("小红","9","女");
Student daming = new Student("大明","11","男");
Student dahong = new Student("大红","10","女");
Student five = new Student("第五个","13","男");
}
}
热心网友 时间:4小时前
哎。一百个字怎么可能?大哥。。我的水平还没那水平。。我做啦。。不好意思代码60行
热心网友 时间:4小时前
不知道有没有好心人帮你...