Here is my code:
Hey there, I'm new to java and to Arrays.
I need to add Data such as the name and age to an ArrayList using the add method, and then display it. But Data cannot be converted into a String (obviously).
I am really quite stuck here, any help would be great thanks.
/>
import java.util.ArrayList;
public class Data { public static void main(String args[]) {
Data [] Names = {"Fred", "Jane", "Zoe"};
ArrayList<Data> array_list = new ArrayList<Data>();
for (Data x: Names)
array_list.add(x);
Hey there, I'm new to java and to Arrays.
I need to add Data such as the name and age to an ArrayList using the add method, and then display it. But Data cannot be converted into a String (obviously).
I am really quite stuck here, any help would be great thanks.