Multiple choice technology programming languages

Can a double value be cast to a byte?

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

A double can be cast to a byte in Java using explicit casting, but this will result in data loss since a byte is only 8 bits while a double is 64 bits. The cast truncates the decimal part and may overflow if the value is outside byte range (-128 to 127).