Engineering Full Stack Apps with Java and JavaScript
Which of the following correctly declare a variable which can hold an array of 10 integers?
Select 2 options
A. int[ ] iA B. int[10] iA C. int iA[ ] D. Object[ ] iA E. Object[10] iA
A, C
Note that an array of integers IS an Object : Object obj = new int[]{ 1, 2, 3 }; // is valid. But it is not an Array of objects. Object[] o = new int[10]; // is not valid. Difference between the placement of square brackets: int[] i, j; //here i and j are both array of integers. int i[], j; //here only i is an array of integers. j is just an integer.
Logged in users see lesser ads and get more features.
If you want to solve the questions together with the experts and understand the concepts better, please contact us using the contact form or WhatsApp numbers. Selected people get to do that without any additional charges.