1Z0-811 Object-Oriented Programming Practice Question
A calculator class has two overloaded methods: add(int a, int b) and add(double a, double b). A call to add(3, 4) will invoke which method?
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
✓
add(int, int)
Overloaded method resolution is based on compile-time types. The literal 3 and 4 are ints, so the int version is the most specific match and is called.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
add(double, double)
Why it's wrong here
Widening conversion would be needed, but the exact match is chosen.
- ✓
add(int, int)
Why this is correct
Correct. The arguments are int literals, so the int version is invoked.
- ✗
Runtime decision based on actual parameters
Why it's wrong here
Overload resolution is a compile-time decision.
- ✗
Compilation error: ambiguous
Why it's wrong here
No ambiguity; one method is clearly more specific.
Go deeper
Related to this question
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 →
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.