Courseiva
Question 388 of 481
Arrays and MethodsmediumMultiple ChoiceObjective-mapped

1Z0-811 Arrays and Methods Practice Question

Which method invocation is ambiguous given these overloaded methods? public void process(int[] a) and public void process(int... a)

⚠ Common exam trap

Many candidates think varargs and array parameters are distinct, but they are not; the compiler treats them as identical when the argument is an array, leading to ambiguity.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

process(new int[]{1, 2});

When you call process(new int[]{1, 2}), the compiler cannot determine whether to use the method with an int[] parameter or the varargs method (int... a). Both methods have the same signature after type erasure, and the argument is an int array, which matches both exactly, causing an ambiguity error.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • process(1, 2);

    Why it's wrong here

    Only varargs matches (int...).

  • process((int[]) null);

    Why it's wrong here

    Explicit cast to int[] resolves to the array version.

  • process();

    Why it's wrong here

    Only varargs matches (empty arguments).

  • process(new int[]{1, 2});

    Why this is correct

    Both methods accept an int array, causing ambiguity.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 25, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This 1Z0-811 practice question is part of Courseiva's free Oracle certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 1Z0-811 exam.