What is the output when the following code runs Explain whic
What is the output when the following code runs? Explain which methods are called, in which order, what the various parameters being passed in are, and what values are returned.
Solution
output will be:
a: 10
a and b: 15 , 25
40
double a: 7.7
Result: 15.4
Explanation: First add with one argument as int will be called and value of a will be printed.
the method add with two arguments will be called and value of a and b will be printed.
then int sum = num.add(15,25) will add the both arguments and value of sum will be printed.
then method add with one argument as double will be called and value of double a will be printed.
and then result will be printed.

