Answer:
Check the explanation
Explanation:
(1)
class Brainlyarray{
public static void main(String args[]){
double myExams[]=new double[4]; //declaration & instantiation
(2)
Each index of the array myExams have a garbage value stored on it's every index as at this point only the array is declared but not initialized the indexes are not holding any value yet.
(3)
myExams[0]=92.3; //initialization
myExams[1]=82.0; //initialization
myExams[2]=98.4; //initialization
myExams[3]=91.0; //initialization
(4)
System.out.println(myExams[1]); // Will Print the 2nd component of the array
(5)
It will print the 2nd index of the 1D array myExams and the value which will be printed on the screen is 82.0
(6)
for(int i=0;i<myExams.length;i++) // length is the size of this 1D array and in this for loop this loop will run till the end of the length of the array which means till the size of the array.
System.out.println(myExams[i]);
(7)
double sum=0.0; // Delaration of the sum variable
for(double num : myExams){ //For loop here num is the storage container where all the elements of the array myExams are been stored
sum=sum+num;
}
(8)
Array Bound Checking is basically the process in which it is being ensured that the value that is been entered is meeting the array boundaries or not as the array index value should be equal or greater than zero and less or equal to the size of the array.
and if we enter an invalid index value so it will be throwing an exception in thread of the main.
(9)
for ( double value : myExams){ //for each loop (Enhanced for loop )
System.out.println(myExams);
}
////////////////////////////////////////////////////////////////////////////////