I am studying for the Java 7 OCA Exam and I have a doubt about array initializing. Why is there a compilation error here:
Object[] obj = new Object[]{ "aaa", new Object(), new ArrayList(), {} };
But not here:
Object[] obj = new Object[]{ "aaa", new Object(), new ArrayList(), new Object[]{} };
If I am not wrong, both {} and new Object[] are arrays, which in turn are objects. What I am missing here?