English

Which of the following pairs of methods will cause a compile-time error due to incorrect method overloading? - Computer Applications

Advertisements
Advertisements

Question

Which of the following pairs of methods will cause a compile-time error due to incorrect method overloading?

Options

  • void test(int a, int b) and void test(double a, double b)

  • void test(int a, double b) and void test(double a, int b)

  • void test(int a, double b) and void test(int a)

  • void test(int a) and int test(int a)

MCQ
Advertisements

Solution

void test(int a, double b) and void test(int a)

Explanation:

The first method prototype expects an int a and a double b, whereas the pairing method sends only an int.

shaalaa.com
  Is there an error in this question or solution?
2024-2025 (March) Official Board
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×