Question 6 Which of the following statements about method overloading in Java is true? a. Overloaded methods must have a different name and return type. b. Overloaded methods can have different access modifiers. c. Overloaded methods must have the same name and return type. d. Overloaded methods cannot have parameters.
10 months agoReport content

Answer

Full Solution Locked

Sign in to view the complete step-by-step solution and unlock all study resources.

Step 1:
: Understand the question and the concept of method overloading in Java.

Method overloading is when you have multiple methods with the same name but different parameters in the same class.

Step 2:
: Review the options given in the question.

a. Overloaded methods must have a different name and return type. (Incorrect, they can have the same return type) b. Overloaded methods can have different access modifiers. (Correct) c. Overloaded methods must have the same name and return type. (Incorrect, they must have the same name but not the same return type) d. Overloaded methods cannot have parameters. (Incorrect, parameters are what differentiate overloaded methods)

Step 3:
: Identify the correct answer.

The correct answer is option b: Overloaded methods can have different access modifiers.

Final Answer

The statement "Overloaded methods can have different access modifiers" is true.