Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java programming question: Given the following method declaration, static int do

ID: 3766291 • Letter: J

Question

Java programming question:

Given the following method declaration,

static int doThis( int a, double b, int[] c, boolean d)

Identify which of the calling statements are valid? If they are valid, identify the correspondence between parameters and arguments. If not valid, provide reason(s) for the same. Provide also the possible declarations that need to be in the calling method.

doThis( one, two, three, four);

what = doThis( one, two, three, four);

which = doThis(20, 2.5, 43, 1);

which = doThis(20, 2* a, 43, false);

Explanation / Answer

Answer:

Only First & Second Delarations are valid as in both of them one,two,three & four can be declared according to function parameters .The possible declarations that must be in the calling method are:

int>

double two=2.5;

int[] three=new int[3];

boolean four=true;

However, in case of both 3rd & 4th option, the parameters passed while calling the function prototype are not matching properly.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote