new

The new keyword creates a new object or array.

Purpose

This allocation expression is used to create a new object.

Syntax

new className 
(
arguments 
) ; 

Description

In the case of arrays, you can specify how to initialize it with the initialValues method.

Example

Integer i = new Integer(value);

int[][] array = new int[][]{new int[]{1, 2}, new int[]{3, 4}, new int[]{5, 6, 7}};

i is an object of type Integer.

array is a two-dimensional array. The first dimension is itself an array of length 3, that is, the number of elements that are enclosed in braces in the initialValues list.