What will be the output when you compile and execute the following program.
////////////////////////////////////////////
01: class Base
02:{
03: static final int MAX_SIZE;
04: Base(){
05: MAX_SIZE = 10;
06: }
07:
08: void
test() {
09: MAX_SIZE++;
10: System.out.println("Base.test()");
11: }
12:
13:}
Select all valid answers.
a) Compilation Error at Line 03: Blank final variable 'MAX_SIZE' may not have been
initialized. It must be assigned a value in an initializer, or in every constructor.
b) Compilation Error at Line 05: Can't assign a second value to a blank final variable:
c) Compilation Error at Line 09: Can't assign a second value to a blank final variable:
d) No errors
The ans they give is A B C
I wrote was C as i think when a var is final then it can be assigned a val in constructors if not given any value while declaring.
------------------
Find A Purpose In Life So Big That It Will Challenge Every Capacity To Be At Your Best.