What will be the result of compiling and running the following program?

import java.util.ArrayList;
import java.util.List;

public class Test {
    public static void main(String a[]) {
        List<Integer> list = new ArrayList<Integer>();
        list.add(null);
        for (Integer i : list) {
            System.out.println(i);
        }
    }
}

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Java quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes