+ 2
What does ___sum ((int)a, (int) b)___do exactly? (line 5)
public class Program{ public static void main (String []args){ double a = 3.14; double b = 5.56; sum((int)a,(int)b);} static void sum (int a,int b) { System .out .println (a+b); } }
3 Respostas
+ 3
the (int) convert double data type to integer data type......
so 3.14 and 5.56 get converted into 3 and 5 respectively...
then these integers i.e. 3 and 5 are used as parameters when calling the sum function.......
+ 2
It will add those two perimeters together, sum(a, b) is the same like a+b
+ 1
It calls the sum functions with the parameters (int)a (==3) and (int)b (==5)