KnowledgeBoat Logo
|

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