Courseiva
Java Basics and SyntaxmediumMultiple ChoiceObjective-mapped

1Z0-811 Java Basics and Syntax Practice Question

Given methods: void print(Integer i) { System.out.println("Integer"); } void print(int i) { System.out.println("int"); } What is output of print(10);?

⚠ Common exam trap

Oracle often tests the misconception that autoboxing will always convert a primitive to its wrapper type, leading candidates to incorrectly choose the Integer overload, but the compiler prioritizes exact primitive matches to avoid unnecessary boxing.

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

"int"

When calling print(10) with an integer literal, Java's method overloading resolution prefers the primitive int version over the Integer wrapper type because the literal 10 is a primitive int. The compiler selects the most specific matching method without requiring autoboxing, so the void print(int i) method is invoked, printing "int".

Answer analysis

Option-by-option breakdown

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

  • Compilation error

    Why it's wrong here

    Incorrect. Both methods are valid.

  • "int"

    Why this is correct

    Correct. Exact match with int parameter.

  • "Integer"

    Why it's wrong here

    Incorrect. Autoboxing is not used when exact match exists.

  • Runtime error

    Why it's wrong here

    Incorrect. No ambiguity at runtime.

About these practice questions

This 1Z0-811 question is part of Courseiva's 481-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.