Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Java code Question..?

public static int fiveEight( int a, double b )

{

return 5;

}

public static int fiveEight( double a, int b )

{

return 8;

}

If, for example, the statement fiveEight( 5.2, 3 ) was executed, would Java execute the second method to obtain the value 8? Or would an error occur?

2 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    it would match the two parameters with the appropriate method parameters,

    so yes the second method would be called to recieve an 8

  • Anonymous
    1 decade ago

    The methods have different signatures, so it would compile and run.

Still have questions? Get your answers by asking now.