Q. What will be the output of the following code

Code:
import java.util.ArrayList;
import java.util.List;

public class MyClass {
public static void main (String args[])
{
//Insert Here
List<String> list=new ArrayList<String>();
list.add(“a”);
list.add(“b”);
l.add(list);

}
}
  • (A) List l=new ArrayList>();
  • (B) List> l=new ArrayList>();
  • (C) List> l=new ArrayList();
  • (D) List l=new ArrayList();
πŸ’¬ Discuss
βœ… Correct Answer: (D) List l=new ArrayList();

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
229
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Pradeep Sikarwar
Publisher
πŸ“ˆ
89%
Success Rate