Should all the elements in Java arrays be of the same type?
Explanation
All the elements in Java array should be of the same type except for cases allowed by polymorphism. When you create an array, you should specify the type of elements that can be contained in it. If it is not a primitive type but a type defined through some class, then the actual array, in addition to objects of the specified class, may also contain objects of the classes that are, in turn, subclasses of the class that was specified in the initial array declaration. http://javapd.blogspot.com/

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes