student练习

  1. package 枚举;
  2. enum Genders{//enum枚举关键字 类比较多 有需求就去查API
  3. L1,L2,L3
  4. }
  5. class Student{
  6. public void choose(Genders s){
  7. switch(s){
  8. case L1:
  9. System.out.println("Java初级程序员");
  10. break;
  11. case L2:
  12. System.out.println("Java高级程序员");
  13. break;
  14. case L3:
  15. System.out.println("Java架构师");
  16. break;
  17. }
  18. }
  19. public static void main(String[] args) {
  20. Student stu=new Student();
  21. stu.choose(Genders.L1);
  22. stu.choose(Genders.L2);
  23. stu.choose(Genders.L3);
  24. }
  25. }
文档更新时间: 2020-11-04 13:13   作者:mlrs