官术网_书友最值得收藏!

Code check – part 1

One of our programmers, Aarav, refactored some code by his team member, Pavni. The code no longer provides char and the corresponding ASCII numbers of the values stored by the char array. Can you help Aarav? The following is the code to use:

class Foo {   
    public static void main(String args[]) {   
        try {   
           char[] name = new char[]{'S','t','r','i','n','g'};   
           for (var c : name) {   
               System.out.println(c + ":"   + (c + 1 - 1));   
           }   
        }   
        catch (var e) {   
            //code   
        }   
    }   
}   

The answer to the code check: The var type can't be used to specify the types of exceptions in the catch handler, (var e).

主站蜘蛛池模板: 金乡县| 南华县| 凤山县| 普洱| 简阳市| 六盘水市| 安宁市| 清河县| 黑水县| 大连市| 香港 | 敦煌市| 赤峰市| 鸡东县| 正镶白旗| 嘉峪关市| 湖口县| 台北县| 饶平县| 新营市| 永嘉县| 三台县| 大关县| 屯留县| 聂拉木县| 鄂托克前旗| 麻栗坡县| 兰溪市| 祁东县| 德江县| 阿克陶县| 河南省| 平舆县| 合川市| 集安市| 中牟县| 华安县| 南阳市| 上林县| 绥宁县| 将乐县|