这到题,谁会做啊,教我???

来源:百度知道 编辑:UC知道 时间:2024/06/24 23:25:09
编写一个学生类students,该类包括学号no,姓名name,性别sex和年龄age变量,该类的成员方法有getNo,getName,getSex,getAge和setAge.(要求用java编写),本人不会java.

..........
.........
基本的基本啊。
public class student{
public int no;
public String name;
public String sex;
public int age

public int getNo(){
return no;
}
public String getName(){
return name;
}
public String getSex(){
return sex;
}
public int getAge(){
return age;
}
public int setAge(int a){
this.age=a
}
}

/**
* 编写一个学生类students,该类包括学号no,姓名name,性别sex和年龄age变量,
* 该类的成员方法有getNo,getName,getSex,getAge和setAge.(要求用java编写),
*
*/
public class Student {
private String no;
private String name;
private String sex;
private int age;
public Student(String no, String name, String sex, int age) {
super();
this.no = no;
this.name = name;
this.sex = sex;
this.age = age;
}
public Student() {
super();
}
public String getNo() {
return no;
}