JAVA · ОСНОВЫ · LESSON 14
Go around the whole array.
for-each loop · about 14 minutes
Learning with progressRead the summary for free. To save the work, log in to the account.
Type the code yourself
Type an example manually. Check the signs and brackets.
public class Main {
public static void main(String[] args) {
int[] nums = {2, 4};
for (int number : nums) {
System.out.println(number);
}
}
}Open the editor for class workSolve it yourself
Create int[] coins from 1, 3, 5. With for-each, output each number. The current element is called coin.
The answer is hidden. Use similar examples from the lesson notes.
Opening up your homework