程序输出结果是多少?

public class getValue {
    public static void main(String[] args) {
        System.out.println(getValue(2));

    }
    
    public static int getValue(int i){
        int result = 0;
        switch(i){
        case 1:
            result = result + i;
        case 2:
            result = result + i*2;
        case 3:
            result = result + i*3;
        }
        return result;
    }

}

 

posted on 2016-05-10 13:14  dangjunhui  阅读(162)  评论(0编辑  收藏  举报

导航