I need to display multiple list arrays in one line through the for loop - so basically I need to count them as well.
Example:
Here is my code:
List<String> name = new ArrayList<String>();
List<String> number = new ArrayList<String>();
name.add("Tommy"); // Test name
name.add("Tom"); // Test name 2
number.add(new String("123-456-7890")); // Test phone number
number.add(new String("098-765-4321")); // Test phone number 2
for (String d:name) {
System.out.print(d);
}
for (String b:number) {
System.out.println(b);
}
And here is my output with my code:
Sorry if this question was duplicated, if it is, I will delete my question right away but for now I haven't fount anything like this.
Thank you.