20 lines
511 B
Java
20 lines
511 B
Java
// housekeeping/ArrayInit.java
|
|
// (c)2021 MindView LLC: see Copyright.txt
|
|
// We make no guarantees that this code is fit for any purpose.
|
|
// Visit http://OnJava8.com for more book information.
|
|
// Array initialization
|
|
import java.util.*;
|
|
|
|
public class ArrayInit {
|
|
public static void main(String[] args) {
|
|
Integer[] a = { 1, 2, 3, };
|
|
Integer[] b = new Integer[]{ 1, 2, 3, };
|
|
System.out.println(Arrays.toString(a));
|
|
System.out.println(Arrays.toString(b));
|
|
}
|
|
}
|
|
/* Output:
|
|
[1, 2, 3]
|
|
[1, 2, 3]
|
|
*/
|