Hai guys, iam learning java at the moment, and I got problem on arraylist.
Iam asked to do a store a name of a person, Ben, Luke, Hawk, and their age in to an arraylist and display it vertically, Suppose to be like this:
Name Age
Ben 15
Luke 14
Hawk 19
Here is what i done in main.java:
ArrayList<String> names = new ArrayList<String>();
names.add("Ben");
names.add("Luke");
names.add("Hawk");
System.out.println(names);
but it prints horizontaly, and the age will also too.
Can anybody have time to share the clue?
And 1 more think, we do this in main.java or in class.java ? iam waiting for reply^^