The variable "varargs" is introduced in the signature of the Object... objArr method. Each argument passed when calling such a method gets its own slot in the array of this name.
Therefore, when you pass one null , you get an objArr array of length 1, the only element of which is null . The array itself is not NULL; this element matters.
JLS, section 8.4.1 calls these "arity variable parameters":
The last formal parameter of a method or constructor is special: it can be a variable parameter arity, indicated by an ellipsis, of the following type.
and
Arity method method calls may contain more relevant arguments than formal parameters. All actual arguments of the expression that do not match the formal parameters preceding the parameter of the arity variable will be evaluated and the results stored in an array that will be passed to the method call (§15.12.4.2).
(my accent)
rgettman
source share