📄 student.java
字号:
package classextends;
/**
* <p>Title: Student类</p>
*
* <p>Description: 描述学生的基本属性</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: neusoft.edu.cn</p>
*
* @author gy
* @version 1.0
*/
public class Student{
/** 表示姓名的字符串变量*/
public String name;
/** 表示姓性别的字符串变量(男或女)*/
public String sex;
/** 表示年龄的整型变量*/
public int age;
/** 表示身高的浮点型变量,单位:米*/
public float height;
/** 表示体重的浮点型变量,单位:公斤*/
public int weight;
/** 表示学号的字符串变量*/
public String stuNo;
/** 表示所在院校的字符串变量*/
public String school;
/** 表示所学专业的字符串变量*/
public String profession;
/** 表示入学时间的字符串变量*/
public String enrollDate;
/**
* 无参数的构造函数
*/
public Student(){
}
/**
* 有参数的构造函数
* @param name String 姓名
* @param sex String 性别
* @param age int 年龄
* @param height float 身高
* @param weight int 体重
* @param stuNo String 学号
* @param school String 所在院校
* @param profession String 所学专业
* @param enrollDate String 入学时间
*/
public Student(String name, String sex, int age,
float height, int weight, String stuNo,
String school, String profession, String enrollDate){
this.name = name;
this.sex = sex;
this.age = age;
this.height = height;
this.weight = weight;
this.stuNo = stuNo;
this.school = school;
this.profession = profession;
this.enrollDate = enrollDate;
}
/**
* 获得某学生的自然条件信息,并打印输出表示该信息的字符串
* 如:李明,男,21岁,身高1.75米,体重70公斤
*/
public void getInfo(){
String info;
info = name + ", " + sex + ", " + age + " 岁," +
" 身高" + height + "米, 体重" + weight + "公斤";
System.out.println("Student getInfo():" + info);
}
/**
* 获得某名学生的学籍信息,并打印输出表示该信息的字符串
* 如:李明,学号:001,所在学校:xx大学,专业:计算机,入学时间:2002年9月
*/
public void getStuInfo() {
String stuInfo;
stuInfo = name + ", 学号:" + stuNo + ", 所在学校:" + school +
", 专业:" + profession + ", 入学时间:" + enrollDate;
System.out.println("Student getStuInfo():" + stuInfo);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -