Java Coding Practice
Practice typing real code syntax, including brackets, punctuation, and indentation. Snippets are for typing practice only and are never executed.
Arrays and loops
Type the code exactly. Tab inserts four spaces. Code is not executed.
Progress: 0%
Current mismatches: 0
public class ArraySum {
public static void main(String[] args) {
int[] values = {4, 7, 2, 9};
int total = 0;
for (int value : values) {
total += value;
}
System.out.printf("Total: %d%n", total);
}
}
Type the code exactly, including spaces and indentation.