Menu
Question Index
...

Which of the following declaration will help the program without errors?

import java.util.*;

public class DemoOnLists {
    public static void main(String args[]) {
        //LINE A
        for (int i = 0; i < 10; i++) {
            ArrayList<Integer> myList = new ArrayList<Integer>();
            for (int j = 0; j < 10; j++)
                myList.add(i * j);
            container.add(myList);
        }
        for (List<Integer> value : container) {
            System.out.println(value);
        }
    }
}


List<List<Integer>> container = new List<List<Integer>>();
ArrayList<ArrayList<Integer>> container = new ArrayList<ArrayList<Integer>>();
List<List,Integer> container = new ArrayList<List,Integer>();
None of the above

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App