When is a for loop used in a Java Program?

A. When you already know how many times to perform an action.
B. When you want to test how many times to perform an action.
C. When you don't know how many times to perform an action.
D. When you want to define the name of an action.

Respuesta :

Answer:

A

Explanation

Use "for loop" when size/length is pre-defined/know, such as

int[] numbers = new int[]{ 1,2,3,4,5,6,7,8,9,10 };

length : 10

snippet:

numbers.forEach(int num in numbers){

}

// or

for(int i=0; i < numbers.length ; i++){

}