5. What is the result when you compile and run the following program?
public class MyArray {
public static void main(String arg[]){
int myArray []= new int [10];
for (int i=0; i<myArray.length; i++) {
System.out.println(myArray[i]);
}
}
}
[a] Prints all 0's on the screen from 0 to 9 in sequence.
[b] Prints on the screen from 1 to 10 in sequence.
[c] Prints on the screen 0 only.
[d] Compile time error.
Answer
[a] Prints all 0's on the screen from 0 to 9 in sequence |