+ 1

Could you please explain to me all type conversions of the following program section (e.g. "In partial output x+y implicitly con

double a = 5.5; long b = 2; float c = 3.3f; a = (b * c) + (c / a); int d = ( int )(b + c);

29th Apr 2020, 10:05 AM
Mohammad Ala Tahhan
Mohammad Ala Tahhan - avatar
2 Respostas
+ 1
In the third line : The first bracket will get executed which multiplies b and c. b is a long and c is float data type so the answer of b*c would be in float type. Then the second bracket of third line which divides c to a. c is a float type and a is double so the answer of c/a would be converted to double. Then the answer from 2 brackets will be added means float + double which will result in double. At third line you got a double value let's move to last line. in last first we will solve the bracket which is b+c b is a long and c is float so the resultant will be a float value which would get converted into int. Hope you got it
29th Apr 2020, 10:19 AM
Nitin Tiwari
Nitin Tiwari - avatar
0
Mohammad Ala Tahhan that's the fourth question of yours in a row (successively): are you doing bagde hunting? Please kindly avoid spamming QnA ^^
29th Apr 2020, 10:45 AM
visph
visph - avatar