Courseiva
Java Basics and SyntaxeasyMultiple ChoiceObjective-mapped

1Z0-811 Java Basics and Syntax Practice Question

A class defines two methods with the same name but different parameter lists. This is known as:

⚠ Common exam trap

Test-takers frequently confuse method overloading with method overriding because both involve methods with the same name, but overriding requires identical parameter lists and occurs in inheritance, while overloading requires different parameter lists and can occur in the same class.

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

Method overloading

Method overloading occurs when a class defines multiple methods with the same name but different parameter lists (different number, type, or order of parameters). This is a compile-time polymorphism mechanism in Java that allows a method to handle different inputs without changing its name.

Answer analysis

Option-by-option breakdown

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

  • Method overriding

    Why it's wrong here

    Overriding requires same signature in subclass.

  • Method hiding

    Why it's wrong here

    Hiding applies to static methods.

  • Method shadowing

    Why it's wrong here

    Shadowing refers to variable scope.

  • Method overloading

    Why this is correct

    Overloading allows same name, different parameters.

About these practice questions

One of 481 original 1Z0-811 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Same concept, more angles

1 more way this is tested on 1Z0-811

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A class has two methods: void setValue(int a) and void setValue(double a). Which call will result in a compilation error?

medium
  • A.setValue(5.0);
  • B.setValue(5); setValue(5.0); both in same class
  • C.setValue(5);
  • D.setValue((int)5.0);

Why B: Since the class contains both overloaded methods void setValue(int a) and void setValue(double a), all the provided calls are valid and compile without error. setValue(5) calls the int version, setValue(5.0) calls the double version, and setValue((int)5.0) explicitly casts to int, calling the int version. Option B consists of two separate valid calls within the same class, so no compilation error occurs. Therefore, none of the options result in a compilation error.

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.