I have a simple piece of code, but there is one part that I cannot complete. How do I print all the elements of an array after I have inputted them from the keyboard in a for loop,
here is the code. Thanks.
final int MAX = 5;
String [] names = new String[MAX];
for(int index = 0; index < MAX; index++){
System.out.println("Enter a name: ");
names[index]=keyboard.nextLine();
}
System.out.println(names);