Answer to Question #267715 in Java | JSP | JSF for candy

Question #267715

how to use the arraylist to record the module details in student class?


1
Expert's answer
2021-11-19T10:02:32-0500
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));
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS