What are the contents of array1 and array2 after the followi

What are the contents of array1 and array2 after the following statements execute: int[] array1 = new double[5]; arrayl [0] = 67; arrayl [1] = 68; double [] array2 = arrayl; array2[0] = 69; array2[1] = 70; array2[2] = 71;

Solution

Above statements will result in error because in statement 1(int array1 = new double[5];) we are trying to convert double to integer which not allowed in java.

It will give the below error :

error : incompatible types : double[] cannot be converted to int[]

 What are the contents of array1 and array2 after the following statements execute: int[] array1 = new double[5]; arrayl [0] = 67; arrayl [1] = 68; double [] ar

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site