Trying to learn Java. I am working on arrays. Here is a simple program that the output is not being displayed as I want it to be.
package arrays2;
public class Arrays2 {
public static void main(String[] args) {
int[] userAge;
userAge = new int[] {22,24,26,27,28};
System.out.println("The ages of my friends are " + userAge + ".");
}
}
The output shows:
run: The ages of my friends are [I@15db9742. BUILD SUCCESSFUL (total time: 0 seconds)
Shouldn't the output be displayed as:
The ages of my friends are 22,24,26,27,28.