June 2018
Beginner
722 pages
18h 47m
English
An array initializer consists of a comma-separated list of expressions, enclosed in braces {}. The comma after the last expression is allowed and ignored:
String[] arr = {"s0", "s1", };System.out.println(Arrays.toString(arr)); //prints: [s0, s1]
We often use this way of initializing an array in our examples because it is the most compact way to do it.
Read now
Unlock full access