import java.util.Scanner; public class eg03array { public static void main(String[] args) { int numTests; int[] tests; Scanner keyboard = new Scanner(System.in); System.out.println("How many tests do you have? "); numTests = keyboard.nextInt(); tests = new int[numTests]; //length is a field for the created array object for (int index = 0; index < tests.length; index++) { System.out.print("Enter test score " + (index + 1) + ": "); tests[index] = keyboard.nextInt(); } System.out.println(); System.out.println("Here are the scores you entered: "); for (int index = 0; index < tests.length; index++) { System.out.print (tests[index] + " "); } System.out.println(); System.out.println("Repeat the scores you entered with enhanced for loop: "); for (int elevar : tests) { System.out.print (elevar + " "); } } }