Type[]::new is a special constructor reference that takes an int length and produces a new array of that size, commonly used to supply an array factory without allocating one up front.
IntFunction<String[]> newArray = String[]::new;
String[] arr = newArray.apply(3);
arr[0] = "a";
arr[1] = "b";
arr[2] = "c";
System.out.println("Length: " + arr.length);
System.out.println("Contents: " + Arrays.toString(arr));
Length: 3
Contents: [a, b, c]
Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.
Published 2026-09-27