Computer Science
Predict the return data type in the following expressions:
float m;
p = m/3*(Math.pow(4,3));
Values & Data Types Java
34 Likes
Answer
m/3*(Math.pow(4,3))
⇒ float / int * double
[∵Math.pow returns double]
⇒ float * double
⇒ double
So the return data type of this expression is double.
Answered By
20 Likes
Related Questions
Perform the following:
Assign the value "TEST" to a variable with the requisite data type.
Predict the return data type in the following expressions:
int p; double q;
r = p+q;What are the resulting data types, if the following implicit conversions are performed:
int i; float f; double d; char c; byte b;
(a) i + c/b;
(b) f/d + c*f;
(c) i + f - b*c;
(d) i/c + f/b;
(e) i + f- c + b/d;
What are the resulting data types of the following explicit conversions?
int i; float f; double d; short s; char c; byte b;
(a) (float) i/b + d;
(b) (int)f*d + c/s;
(c) (char)i + f - b*d;
(d) (double) (f/i)*c + s;
(e) (char) d + b/i - f*s;