how to use the arraylist to record the module details in student class?
import java.util.ArrayList;
import java.util.Random;
public class Main {
public static void main(String[] args) {
ArrayList<ArrayList<Integer>> moduleDetails = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 3; i++) {
moduleDetails.add(new ArrayList<>());
moduleDetails.get(i).add(random.nextInt(101));
moduleDetails.get(i).add(random.nextInt(101));
moduleDetails.get(i).add(random.nextInt(101));
moduleDetails.get(i).add(random.nextInt(101));
}
}
}
Comments
Leave a comment