Consider the following code,
import java.util.ArrayList;
public class UselessCode {
public static void main(String args[]){
ArrayList<Integer> x = new ArrayList<Integer>();
x.add(81);
x.add(53);
x.add(27);
for(int i=0; i < Data.size(); ++i)
{
System.out.println(x.get(i));
}
}
}
The output of the code above prints out the three numbers I have added to the array as expected.
Is there a way to modify the code so it adds a persons name to each number?
For example, the output would the be ("Mark", 81), ("Scot", 53) and so on.