2196f54c640535818108b3d156d33d8caf4becf9.svn-base 928 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.sinosoft.cm.test;
  2. import java.util.List;
  3. import com.sinosoft.cm.common.ArrayList;
  4. import com.sinosoft.cm.common.JOSNString;
  5. public class ClassRoom extends JOSNString{
  6. public String no=null;;
  7. public List classMate=null;
  8. //方案1继承JOSNString的toString方法,简单,效率相对较低不易出错
  9. //方案2重写重写toString方法,效率高,复杂易出错
  10. @Override
  11. public String toString() {
  12. return "{\"no\":\""+no+"\",\"classMate\":"+classMate+"}";
  13. }
  14. public ClassRoom(){
  15. super();
  16. classMate=new ArrayList();
  17. }
  18. public ClassRoom(String num){
  19. classMate=new ArrayList();
  20. this.no=num;
  21. }
  22. public String getNo() {
  23. return no;
  24. }
  25. public void setNo(String no) {
  26. this.no = no;
  27. }
  28. public List getClassMate() {
  29. return classMate;
  30. }
  31. public void setClassMate(ArrayList classMate) {
  32. this.classMate = classMate;
  33. }
  34. public void addPeople(People peo){
  35. classMate.add(peo);
  36. }
  37. }