Java allows a trailing comma when enumerating arrays and enum values?

public class Peshev {
    public static void main(String... args) {
        String[] fff = new String[]{"a", "b",};
        System.out.println(fff[0]+fff[1]);
    } 
}

Do you see the trailing comma after "b"? That's allowed. Unexpected from a strongly-typed lang as Java.

3 thoughts on “Java allows a trailing comma when enumerating arrays and enum values?”

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.