n 编写一个Student类,包含name、gender、age、id、score属性,分别为String、String、int、int、double类型。 n 类中声明一个say方法,返回St
时间: 2024-06-16 14:05:24 浏览: 112
编写一个Student,包含name、gender、age、idscore属性,分别为String、String、int、int、double类型。
```java
public class Student {
String name;
private String gender;
private int age;
private int id;
private double score;
public Student name, String gender, int age, int id, double score) {
this.name = name;
this.gender = gender this.age = age;
this.id =;
this.score = score;
}
public String getName() {
return name;
}
public String getGender {
return gender;
}
public int getAge() {
return age;
}
public int getId() {
return id;
}
public double getScore() {
return score;
}
public void say() {
System.out.println("I am a student.");
}
}
```
阅读全文