Methods sharing the same name but different parameter lists are known as_________________?
Show answer Hide answer
Answer: B. Overloading
Explanation
Methods sharing the same name but different parameter lists are known as overloading. Method overloading allows developers to reuse intuitive method names logically. The compiler resolves which method to call based on the provided arguments. Polymorphism in object oriented programming supports both overloading and overriding. Overloaded methods must differ in parameter type, count, or order. Return types alone are insufficient to distinguish between overloaded methods.
Constructors are frequently overloaded to initialize objects with various arguments. Built in libraries use overloading extensively to accept different data inputs. Clean method overloading improves code readability and developer productivity. Overriding occurs when a subclass provides a specific implementation of a superclass method. Constructor is a special initialization method rather than the general overloading concept. None of these is incorrect because method overloading is the right term.
- Subject
- Computer Science
- Category
- Software Engineering
- Topic
- —
- Difficulty
- medium
Related questions
Q1. Which methods control access to an object in multi-threaded programming?
Show answer Hide answer
Answer: A. Synchronized methods
Synchronized methods prevent multiple threads from accessing critical sections simultaneously. Locking mechanisms ensure that only one thread executes a synchronized method at a time. This concurrency control guarantees...
Q2. Java explicitly omits support for which variety of inheritance_____________?
Show answer Hide answer
Answer: D. Multiple
Java explicitly omits multiple class inheritance to prevent ambiguity and the diamond problem. Allowing multiple parent classes would complicate method resolution and compiler design significantly. The correct option cor...
Q3. If a public class contains a protected method, which statement is true?
Show answer Hide answer
Answer: D. This method is accessible from within the class itself and from within all classes defined in the same package as the class itself.
Protected members are accessible within the class itself and subclasses in the same package. Java access control rules grant package-wide visibility alongside subclass inheritance access. This balances encapsulation by a...
Q4. Why do we use an array as a parameter for the main method_________________?
Show answer Hide answer
Answer: A. Can store multiple values
The main method uses a String array parameter to allow programs to accept multiple arguments. Storing command-line inputs in an array accommodates varying numbers of runtime parameters. This array structure is a required...
Q5. Which statement is static and synchronized in the JDBC API?
Show answer Hide answer
Answer: A. getConnection()
The getConnection method is a static factory method used to establish database connections. It manages driver registration and returns a valid connection object for executing queries. The correct option correctly identif...
Q6. What is a base register table___________________?
Show answer Hide answer
Answer: D. is used to remember which of the general-purpose registers are currently available as base registers, and what base addresses they contain
A base register table tracks available general-purpose registers and their base addresses. Operating system control programs use this table to manage physical hardware register allocation. It ensures that programs know w...