Multiple choice technology programming languages

The following code is legal? long longArr[]; int intArr[] = { 7 ,8 , 9}; longArr = intArr;

  1. True

  2. False

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

This code is illegal because you cannot assign an int array to a long array reference. Even though long can hold int values, array types are not compatible - an int[] is not a subtype of long[]. You would need to create a new long array and copy elements individually.