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

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).

主站蜘蛛池模板: 新田县| 灌云县| 鲁甸县| 德惠市| 灵台县| 乡城县| 吐鲁番市| 遵义市| 晋江市| 晴隆县| 枞阳县| 绥滨县| 德保县| 敦化市| 晋州市| 泰安市| 黄冈市| 塘沽区| 南皮县| 晋城| 南通市| 夏邑县| 遂溪县| 杂多县| 高陵县| 娄烦县| 日喀则市| 革吉县| 金塔县| 双柏县| 公安县| 上蔡县| 东光县| 湖口县| 双柏县| 和平县| 正镶白旗| 广平县| 武冈市| 杭州市| 辽中县|