为什么不在数组的末尾附加逗号不会出现任何错误?

时间:2017-04-24 12:11:47

标签: java

class TestClass {

    public static void main(String... args) {
        String[] str = {"amnsi", "haris",};
        //------------------------------^
        for (String s : str) {
            System.out.println(s + " " + str.length);
        }
    }
}

在这种情况下,为什么我之后没有收到任何错误,

0 个答案:

没有答案