KnowledgeBoat Logo
|

Computer Applications

Which of the following is the CORRECT statement to invoke the method with the prototype int display(int a, char ch)?

  1. int m = display('A', 45);
  2. int m = display( );
  3. int m = display(A,45);
  4. int m = display(45,'A');

User Defined Methods

1 Like

Answer

int m = display(45,'A');

Reason — The method display expects two parameters: the first is an int and the second is a char. Among the options, only display(45, 'A') passes the arguments in the correct order and with the correct types—45 as an integer and 'A' as a character literal.

Answered By

3 Likes


Related Questions