Engineering Full Stack Apps with Java and JavaScript
What will the following code print when compiled and run?
import java.util.*; public class TestClass { public static void main(String[] args) throws Exception { ArrayList<String> al = new ArrayList<String>(); al.add("111"); al.add("222"); System.out.println(al.get(al.size())); } }
Select 1 option
A. It will not compile.
B. It will throw a NullPointerException at run time.
C. It will throw an IndexOutOfBoundsException at run time.
D. 222
E. null