• 7.27作业


    public class Xueyuan {
        private  String name;
        private  String sex ;
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getSex() {
            return sex;
        }
        public void setSex(String sex) {
            this.sex = sex;
        }
        public Xueyuan(String name,String sex) {
            super();
            this.name = name;
            this.sex = sex;
            
        }
        
    
    }
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Scanner;
    
    public class XueyuanTest {
        static Scanner sc = new Scanner(System.in);
        public static void main(String[] args) {
            
            Xueyuan stu = new Xueyuan("李明","");
            Xueyuan stu2 = new Xueyuan("张三","");
            Xueyuan stu3 = new Xueyuan("李娜","");
            Map map = new HashMap();
            map.put("JACK",stu);
            map.put("ZED",stu2);
            map.put("ROSE",stu3);
            System.out.println("请输入学员英文名:");
            String eName = sc.next();
            if(map.containsKey(eName)) {
                Xueyuan xue = (Xueyuan)map.get(eName);
                System.out.println("英文名为"+eName+"的学员名字:"+xue.getName()+",性别是:"+xue.getSex());
                
            }else {
                System.out.println("没有找到该学员信息");
            }
                    
        }
    
    }

  • 相关阅读:
    stat 命令家族(2)- 详解 pidstat
    stat 命令家族(1)- 详解 vmstat
    Linux常用命令
    Linux常用命令
    Linux常用命令
    Linux常用命令
    Linux常用命令
    Linux常用命令
    打通MySQL架构和业务的任督二脉
    PostgreSQL JOIN LATERAL
  • 原文地址:https://www.cnblogs.com/hxtzzz/p/11262979.html
Copyright © 2020-2023  润新知