Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Why it is not possible to do method overloading by changing return type of method in java?

Pragya Keshap answered on February 4, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • does overloading method can have different return type
  • program for method overloading in java
  • Can we override the static method?
  • Java Method Overriding
  • What's method overloading
  • Java Constructor Overloading
  • overload and override in java
  • what's method overriding
  • method overloading
  • Method overloading
  • method override java
  • method overloading
  • Describe Methods Overloading in Java
  • can you overload main method?
  • can we override the overloaded method in java
  • Method Overloading
  • method overriding java
  • Example of Method Overloading
  • Method Overriding in java
  • Method Overloading in Java
  • what is method overriding in java
  • Java Method Overloading
  • Does overloading of a method has anything to do with its return type
  • method overloading
  • Method Overloading in java
  • Java Overloading by changing the number of parameters
  • Method Overloading by changing the data type of parameters Java
  • Method Overloading by changing the data type of parameters Java
  • method overloading vs method overriding in python
  • What is the other name of Method Overloading?

  • Why it is not possible to do method overloading by changing return type of method in java?

    0

    If we change the return type of overloaded methods then it will lead to ambiguous behavior.

     How will clients know which method will return what type. 

    Due to this different return type are not allowed in overloaded methods.

    https://www.javatpoint.com/method-overloading-in-java#:~:text=of%20method%20only%3F-,In%20java%2C%20method%20overloading%20is%20not%20possible%20by%20changing%20the,method%20only%20because%20of%20ambiguity.

    Popularity 3/10 Helpfulness 1/10 Language java
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.