Student.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.sf.sx.day04;
  2. /**
  3. * 学生类
  4. */
  5. public class Student {
  6. // 属性
  7. private String sno;
  8. private String sName;
  9. private Integer age;
  10. private Double height;
  11. public Student() {
  12. }
  13. public Student(String sno, String sName, Integer age, Double height) {
  14. this.sno = sno;
  15. this.sName = sName;
  16. this.age = age;
  17. this.height = height;
  18. }
  19. public String getSno() {
  20. return sno;
  21. }
  22. public void setSno(String sno) {
  23. this.sno = sno;
  24. }
  25. public String getsName() {
  26. return sName;
  27. }
  28. public void setsName(String sName) {
  29. this.sName = sName;
  30. }
  31. public Integer getAge() {
  32. return age;
  33. }
  34. public void setAge(Integer age) {
  35. this.age = age;
  36. }
  37. public Double getHeight() {
  38. return height;
  39. }
  40. public void setHeight(Double height) {
  41. this.height = height;
  42. }
  43. @Override
  44. public String toString() {
  45. return "Student{" +
  46. "sno='" + sno + '\'' +
  47. ", sName='" + sName + '\'' +
  48. ", age=" + age +
  49. ", height=" + height +
  50. '}';
  51. }
  52. /**
  53. * 学习方法
  54. * @param sName
  55. */
  56. public void study(String sName){
  57. System.out.println(sName+" 正在学习~");
  58. }
  59. /**
  60. * 吃饭
  61. */
  62. public void eat(){
  63. System.out.println("学生正在吃饭~");
  64. }
  65. }