What Kayalvizhi said is partially correct.But i would like to add one more important point.
Kayal�s response is perfect for the original question posted.
You try to understand Arrays concept better.Array is the one where you can store collection of different items of the same data type.Now look at ur code.It tries to store items of two different data types(one is int(primitive type) & the other is Integer(Wrapper type)).Juz think..how this could be possible?.
This is possible. Look at the code below.
That X array should be declared either as int[] or Integer[] but cant be both.
This is possible. Look at the code below.
As already said u can cast double to an int but not to an Integer. Integer is an object..
Yes.
what sense it makes converting primitive to an object?.
Conversion can be done as below, if there is a requirement to do so.
For original poster:
Data type casting - with in primitive data types
Object casting � with in objects