您当前的位置: 首页 > 

壹小俊

暂无认证

  • 1浏览

    0关注

    885博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

枚举类型与泛型的学习

壹小俊 发布时间:2022-01-23 23:06:13 ,浏览量:1

interface Constants {
    public static final int Constants_A = 1;
    public static final int Constants_B = 12;

}

public class ConstantsTest {
    enum Constants2{
        Constants_A,Constants_B
    }
    public static void doit(int c){
        switch (c){
            case Constants.Constants_A:
                System.out.println("doit() Constants_A");
                break;
            case Constants.Constants_B:
                System.out.println("doit() COnstants_B");
                break;
        }
    }

    public static void doit2(Constants2 c){
        switch (c){
            case Constants_A:
                System.out.println("doit() Constants_A");
                break;
            case Constants_B:
                System.out.println("doit() COnstants_B");
                break;
        }
    }

    public static void compare(Constants2 c){
        for (int i = 0; i             
关注
打赏
1664335782
查看更多评论
0.0426s