What are the proper ways to initialize the static variables SIZE and MIN_VALUE ?
01: class Base
02: {
03: static final int SIZE;
04: static float MIN_VALUE;
05:
06: Base() { }
07: void
test() {
08: System.out.println("Base.test()");
09: }
10:
11:}
Select all valid answers.
a) Add the following lines to Base Class
static {
SIZE = 10;
MIN_VALUE = 10.3f;
}
b) Add the following lines to Base Class
{
SIZE = 10;
MIN_VALUE = 10.3f;
}
c) Add the following lines to Base Class constructor
SIZE = 10;
MIN_VALUE = 10.3f;
d) Modify lines 03 and 04 as
static final int SIZE = 10;
static float MIN_VALUE = 10.3f;
I think d) is right. but in the meanwhile, I have done the test, it shows a) is also right. but who can tell me why?