Which code will not compile?
Reveal answer
Fill a bubble to check yourself
Which code will not compile?
final String abc = "Neeraj"; abc = "Rathi";
final String abc;abc = "Rathi";
final ArrayList al = new ArrayList();al.add("Neeraj");al.add("Rathi");
final int i; i = 0;
A final variable can only be assigned once. In option A, abc is declared final and initialized with 'Neeraj', then reassigned to 'Rathi' - this is illegal. Options B and D are legal blank finals (declared final, assigned once later). Option C works because the reference is final, not the contents - you can modify the list but not reassign al.