【Java】+枚举enum

一、单个值

 二、多个值

package app.enumtest;

public enum TestEnum {
    PH("80", "192.168.1.80", "PhName", "1111"),
    ID("90", "192.168.1.90", "IdName", "2222"),
    BJ("10", "192.168.1.10", "BjName", "3333");

    private String port;
    private String ip;
    private String userName;
    private String passWord;


    TestEnum(String port, String ip, String userName, String passWord) {
        this.port = port;
        this.ip = ip;
        this.userName = userName;
        this.passWord = passWord;
    }

    public String getPort() {
        return port;
    }

    public String getIp() {
        return ip;
    }

    public String getUserName() {
        return userName;
    }

    public String getPassWord() {
        return passWord;
    }
}

 

 

posted @ 2019-08-20 23:32  淡怀  阅读(143)  评论(0编辑  收藏  举报