Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

last comma in array

843853May 17 2005 — edited May 18 2005
I think that it wasn't possible in the previous versions of java. The next code compiles fine with jdk1.5.0:
public class Test {
    public static void main(String[] args) {
        int[] arr1 = {1, 2, 3,};  // <- last comma
        
        String[] arr2;
        arr2 = new String[]{"a", "b", "c",};  // <- last comma
        
        float[] arr3 = {,};  // <- last comma

    }
}
Is it a bug or a feature?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 15 2005
Added on May 17 2005
1 comment
62 views