in java 1) For each method call in the table below, determine which of the metho
ID: 3805974 • Letter: I
Question
in java
1) For each method call in the table below, determine which of the methods on the top table is actually called, or indicate that it is impossible because there is either no method that matches, there are several methods that match, or something else is wrong.
Method
Identifier
Method Signature
a
int addition (int x, int y)
b
double addition(int x, int y)
c
double addition(int x, double y)
d
double addition(double x, double y)
e
double addition (double x, double y, double z)
Method
Identifier
or Impossible
Method Call
double sum = addition(4.2, 3.7);
int sum = addition (4.2, 3);
int sum = addition (3, 5);
double sum = addition (4.2, 3.7, 5.3, 9.4);
double sum = addition (4.2, 3);
Method
Identifier
Method Signature
a
int addition (int x, int y)
b
double addition(int x, int y)
c
double addition(int x, double y)
d
double addition(double x, double y)
e
double addition (double x, double y, double z)
Explanation / Answer
Answers:
double sum = addition(4.2, 3.7); will call d option: double addition(double x, double y)
int sum = addition (4.2, 3); does not have valid method that will return a int.
int sum = addition (3, 5); will call a option: int addition (int x, int y)
double sum = addition (4.2, 3.7, 5.3, 9.4); does not have valid method definition. Miss matching the arguements.
double sum = addition (4.2, 3); will call d option: double addition(double x, double y)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.