Multiple choice technology programming languages

Can you automatically convert long value into int , if the long value is small enough to fit into an int.

  1. True

  2. False

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

Java does not perform automatic narrowing conversions from a larger primitive type like long to a smaller primitive type like int, even if the specific value fits. An explicit cast is required to convert a long to an int.