Computer Applications
Which of the following is a valid way to declare and initialize an integer array to store the ages of 50 students?
Java Arrays
1 Like
Answer
int age[] = new int[50];
Reason — In Java, arrays are declared and initialized using the following syntax:
dataType arrayName[] = new dataType[size];
Here, int age[] = new int[50]; correctly declares an array of size 50 to store integer values.
Answered By
1 Like
Related Questions
Name the below structure:

- One dimensional array
- Two Dimensional array with 4 rows and 5 columns
- Three dimensional array
- Two Dimensional array with 5 rows and 4 columns
Define a class to search for a value input by the user from the list of values given below. If it is found display the message "Search successful", otherwise display the message "Search element not found" using Binary search technique.
5.6, 11.5, 20.8, 35.4, 43.1, 52.4, 66.6, 78.9, 80.0, 95.5.
Define a class pin code and store the given pin codes in a single dimensional array. Sort these pin codes in ascending order using the Selection Sort technique only. Display the sorted array.
110061, 110001, 110029, 110023, 110055, 110006, 110019, 110033