Computer Applications
What will be the resultant type of the following expression if bh represents a byte variable, i is an int variable, fl is a float variable and db is a double variable ?
bh - i + db / fl - i * fl + db / i
Values & Data Types Java
10 Likes
Answer
The resultant data type will be double.
Explanation
bh - i + db / fl - i * fl + db / i
⇒ byte - int + double / float - int * float + double / int
⇒ byte - int + double - float + double
⇒ int + double - float + double
⇒ double - float + double
⇒ double + double
⇒ double
Answered By
8 Likes
Related Questions
What is meant by implicit and explicit type conversion? Explain with an example.
What do you mean by type casting? What is type cast operator in Java?
What will be the resultant type of the following expression if fl is a float variable and db is a double variable?
(int) (fl + db)Determine the data type of the expression
If p is an int, r is a float, q is a long and s is double.