Multiple choice technology programming languages

The following line of code is valid. int x = 9; byte b = x;

  1. True

  2. False

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

In Java, assigning an int to a byte requires an explicit cast because it is a narrowing primitive conversion that can lead to information loss. Without a cast, this code results in a compilation error.