Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
int [][] a = {{1,2,},{3,4}}; int [][] a = {{1,2},{3,4}};
i have two Multidimensional arrays in java. I want to know what's the exact difference in both of them.just see there is a comma after 2 in first one.
JLS 10.6. Array Initializers: A trailing comma may appear after the last expression in an array initializer and is ignored.
Add a comment
There is no difference. The extra comma might be useful if you are formatting your elements one per line, so that every element appears the same.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.